The man is simply suffering from extreme schizophrenia, causing him to completely lose his grip on reality. In actuality he is living in a psychiatric ward but due to his condition doesn't entirely understand where he is, leading to his predicament. Most of his "visitors" are fellow patients that simply enjoy teasing him by going along with his claims to be trapped in "The Cube", often coming up with crazy explanations as to how he became "trapped" there, and occasionally donning costumes to adopt various odd personas and moving chairs and tables whenever his back is turned just to see how he reacts. A few of them are simply the hospital staff doing their best to make him comfortable and trying to help him recover.
The reason he can't leave is because he's been committed and the staff knows he won't be able to function in society. The statement that he has to find "his door" means not any physical doors in the walls or floor, but rather his a psychological one, as in he has to open himself to reality. What we see at the end is the beginning of his recovery. The doctors are starting to get through to him, but he still has not fully released himself from the world created by his mind, hence his apparent return.