Can you clarify what you mean by "when I open a file it automatically
rotates the image"? How is it rotating? What are you expecting to see?
If your image is a photograph that was taken in portrait mode on the camera, the camera may have set a metadata flag that tells Photoshop and other programs to automatically rotate the photo to what the camera thinks is the correct orientation.