It’s both a hazard for emergencies as well as a hygienic nightmare. We all see the people leaving without washing their hands!
Inner doors should swing inward because in case of a fire or other emergency, you don’t want to be trapped inside by something blocking the door that you cannot deal with. Even in something were preventing it from swinging open (like a rope or whatever), in theory the person could still get out because the door hinge would be located on their side and they could simply remove it.
Also because the hinge would have to be on the outside if swinging outward and thus not be securable. As the hung pins could be removed and door opened while locked.
In large building some code requires exterior doors to swing out as pressure build on a fire could jam the door closed. Also some exits require push bar which is swing out.
The in swing though makes sense for more smaller buildings and internal doors. Not wacking people and not getting blocked in seems the better method.