Why does my display turn upside down?

At random times my display will turn upside down. I'm not sure if I'm touching a key or what is happening.

Probably the Gyroscope having a fit.

You can follow this guide to turn that feature off:

Or permanently disable or remove it with the terminal commands:

sudo systemctl stop iio-sensor-proxy.service

sudo systemctl disable iio-sensor-proxy.service

sudo apt-get remove iio-sensor-proxy