Photos from your Nexus 5X coming in turned upside-down? Google explains what's up
In a post at the Google Code boards, Mr. Eino-Ville Talvala, Android's camera framework tech lead, explained that the problem is manufacturers can't always adhere to a particular convention about mounting camera sensors inside their devices. Basically, the Android compatibility requirements expect smartphone makers to align the long-edge of camera sensors with the long edge of the device.
Thus, the back camera sensor ends up oriented in either forward-landscape or reverse-landscape mode. However, there is no strict requirement for which of the two particular directions is right. Usually, manufacturers opt for the forward-landscape orientation, but LG decided to place the sensor reverse-landscape so it could make the most of the limited space available in the Nexus 5X's shell. Most of it is occupied by the spacious 2700mAh battery inside, anyway.
It turns out that reverse-landscape oriented sensors are a rarity, and many a camera app developer do not compensate for it when post-processing an image. However, this should be no longer necessary, as the new Android Camera2 API ensures the image is correctly oriented. However, developers must update their code with the proper API calls. So if your favorite camera app ends up out of date and on the reverse side of landscape, tell the developers and they'll probably react to it!