Because your camera is not rotating the image to the direction you see, it's only changing the metadata which goes with the image. Sloppy, lazy programming.
Open the photo in something like Paint, rotate it clockwise then rotate it anti clockwise. Then save it. It will write the metadata to suit the way the image is displayed on the screen.
Note, if you're afflicted with a mackintosh device, you'll have to find a similar, but different solution.
Edited By Mark Rand on 11/10/2022 16:13:38