In Android there's an option to lock orientation.
Found the explanation: https://9to5google.com/2018/03/07/android-p-rotation-button-...
I’ve experienced this since iPhone 3G or iPhone 4, so I assume this is how they have designed it.
https://discussions.apple.com/thread/8237975
This website shows a workaround for it:
https://www.igeeksblog.com/how-to-lock-rotation-in-iphone-la...