All digital cameras (including smartphones) store the camera's orientation in the Exif data associated with ane embeded in image files. Image viewers read the data in the Exif Orientation field, and display the image accordingly.
The Camera & Imaging Products Association requires that cameras record this data, along with lots of other data, in image files, and most image viewers use this data to display images with their original orientation.
It can't be turned off. (it can generally be turned off for displaying images on the camera, but not on other devices later.)
A few years ago, the implimentation of the Orientation field in image viewers was often misinterpreted. That has since been corrected, so it's possible that you might just need to download and install an update for your image viewing application so it will correctly display your images.
¹ The Lens is the Thing ² 'Full Frame' is the new 'Medium Format' ³ "One good test is worth a thousand expert opinions." - Tex Johnston, Boeing 707 test pilot.