There is an image edit option on the overlay after clicking on a specific image in your Library. There will be a "rotate image" option in the editor.
Without knowing the history of the image file that was uploaded, I would say a common reason this occurs is when a digital picture is taken, it can contain some meta data coded with the image orientation. Even if the image is rotated at some point, that original meta data can persist, and sometimes our system might catch the original data and rotate the picture back to its original form.
Were the images in question taken from a digital camera or smartphone? Is it just happening with photos or any image file you upload?