If your Windows 11 system reboots automatically by itself during your session for an unknown reason, you may never learn why it rebooted. You can turn off the Automatic Restart Feature so you can troubleshoot the error before it disappears on an reboot. To turn off the Automatic Restart Feature, do the following:
Go to Control Panel and in Category view mode select System and Security > System > Advanced system settings.
In the Startup and Recovery section, choose Settings.
Uncheck the box next to Automatically restart
When your system fails now you might be able to at least note the error causing it before you manually reboot it allowing you to troubleshoot the error.
Reasons why your system may automatically restart: incorrect group policies, system infected with malware, faulty storage or other hardware issue, misconfigured settings, and many more reasons. Automatic Restart corrects the issues usually, but you will usually have no knowledge why it failed. instructions above, you at least have a chance to learn why by noting the error AND can save what you have been doing before you manually restart.