Go into settings Battery and device care Tap on the 3 dots on the top right Go into Automation and see if auto restart at set times is on You can turn it off if you want to stop it
Just wanted to add that I use this feature to restart my phone couple of times a week... many people never turn off or restart their phones for a long period of time but restarting does refresh your phone. I think when a phone boots up... it goes through processes to seek out issues etc.
If you tap on that tab You will be able to select the days individually and time that suits you. As someone else has mentioned on another reply. It's good to restart your phone at least once a week really. Helps with optimisation and clearing temporary stored data amongst other things