This can either be caused by a system error (Blue Screen Of Death) or a power problem (where your power supply is asked to supply more than it can deliver. Modern power supplies shut down to prevent permanent damage in such a case).
To determine which it is, we need to disable automatic rebooting when a BSOD occurs. Right click on the start menu, select Settings. Then, in the settings app, select Info (it's the bottom one in the left side panel). Then, at the right hand side there should be (by default in blue text) a clickable entry called "System info" (all this is assuming you have Windows 10 as OS).
In the System panel that now appears, select "advanced system settings" in the left hand side (it's the bottom entry, and has a blue/orange shield next to it). A new dialog box appears. In the Startup and Recovery pane (the bottom one of the 3 you see) press the "Settings" button. And in the box that now appears, uncheck the "Automatically restart" check box. Press "Ok" to confirm.
After this change, whenever a BSOD error occurs, it will remain on screen and you have to manually restart your system to get past it. But it will allow you to see what is on that screen. Which is usually an error code and a reference to a module where that error has occurred. We would like to know both the error code and the module.
On the other hand, if your system still just restarts (thus without displaying a BSOD error), then we know your power supply has issues.