It is to do with the way some places read the data that comes with the photo. The phone adjusts your view according to how you hold it, and adds a bit of data about the orientation, but sometimes these are not read by certain programs, etc.
Happens on the iPad too. So you rotate the iPad to view it and..,
Gaw on then how do you stop that happening You rotate the ipad or whatever and the stupid machine decides it needs to rotate the photo for you and youre no better off than when you started. HC Rimbo