The answer is because when airport bathrooms were designed, it was the days when people never carriedon much. It was all checkin bags back then and it was free. So given one person entering a bathroom stall with no bag, it was ergonomically better to have it open inwards rather than outwards and potentially hit someone outside the stall.
Today, it takes a certain amount of flex/contortion to fit into a stall with an inward opening door with a 22" rollaboard.