The issue on your Lumia 520 flight mode automatically being enabled or is stuck to On, is caused by a software bug and can be resolved by doing the following:
- Back up your stuff.
- Hard reset your phone:
- Power off your phone.
- Next press and hold the Power button until it vibrates. Then, hold down the Volume down button until you see an Exclamation point.
- Press the Volume Up, Volume Down, Power, Volume Down buttons in consecutive order.
- You will see an animated gear icon on the screen indicating that the phone is resetting.
- After hard resetting, use the Windows Device Recovery Tool to restore your phone.
The flight mode will no longer be automatically enabled or be stuck to On after using the said tool.