In the movie Glass, Elijah seems to be able to go in and out of his cell freely, I think he explains it at some point but speaking it very fast and since English isn't my native language I couldn't understand. How did he manage to do that?
It is never fully explained how Elijah had been able to initially escape from his room, other than to show that he had been swapping his sedatives for aspirin that he had stolen.
Staple explains early in the movie that Elijah had managed to get a glimpse of the architectural blueprints of the building and almost manufacture an escape once before, so I think that it is assumed he simply figured out another way to get out of his locked cell considering that he hadn't been under sedation for some time.
It also makes clear that Elijah had been coming and going from his cell multiple times before, as he knew the comings and goings of the orderlies, so him speaking with Patricia was not the first instance of him escaping.