Iphone automatically goes to airplane mode at night?

I leave my phone on the side and when I wake up my phone is in airplane mode this is the second night it has happened. What can I do?

Are you sure you aren't mistaking Airplane Mode for Do Not Disturb? In iOS 12, if you have the Bedtime option enabled in the Clock app it now automatically also turns on Do Not Disturb for the time period as well.

Check there to see if that's the case.