Why this happens
Flatbed and sheet-fed scanners record whatever orientation the paper was fed in — a landscape page run through a scanner set up for portrait documents comes out rotated 90 degrees, and a page inserted upside down comes out flipped. Scanner software doesn't reliably auto-detect this, so it's a very common artifact, especially in bulk-scanned multi-page documents.
Rotating the whole file at once
When every page in a document has the same orientation problem — the whole thing was fed into the scanner the same wrong way — rotating the entire file 90 or 180 degrees in one action fixes it in a single pass, rather than requiring per-page fixes.
Always check the result before treating it as done: a document rotated 90 degrees clockwise when it needed a counter-clockwise turn will look briefly "fixed" but is actually now upside down along a different axis. Look at actual readable text in the preview, not just whether the page looks less sideways than before.
When only one page is wrong
A whole-document rotation tool rotates every page together, which is the wrong fit when just one page out of fifty came out sideways — common when a single sheet was fed in backward during an otherwise correctly-oriented scan run. For that case, the fix is either to re-scan just that one page correctly, or use a tool that supports rotating individual pages rather than the whole file.