Orientation lock prevents the display from rotating itself when the device is turned to landscape mode.
1. For devices that are iPhone 8 and older: Swipe up from the bottom of the display to open the control center.
For devices that are iPhone X and newer: Swipe down from the top of the display to open the Control Center.
2. Find the orientation lock button.
3. Tap on the button to toggle orientation lock ON or OFF. (When the orientation lock is ON the device will remain in portrait mode when rotated to landscape mode).