Chosen Solution
iPhone 5 stock compass&level app is behaving very strange, moving all by itself. Not displaying correct inclinations nor the sides of the world. But, rotation is working flawlessly. Here is the demo while laying flat on the table. It should be zero degrees. Also compass is like that. Level: DEMO Compass: DEMO Restore, respring, hard reset, calibration didn’t help. What might be the problem?
It does look like there is physical damage to the gyroscope chip. Replace it and see if it improves.
Try checking for updates on the app, or reinstalling it.