Your Xbox One console may unexpectedly turn off under the following circumstances:
The console is too hot.
There's a problem with the power supply.
Reset your internal power supply
The Xbox One S and Xbox One X have an internal power supply that works in all regions worldwide. If your console won't turn on, it may simply need a power reset. Often, power issues are due to the power supply resetting after a power surge.
To reset the internal power supply, follow these steps:
Unplug the power cord from the console.
Wait 10 seconds.
Plug the cord back into the console, and then press the Xbox button on the front of the console.
or perhaps your power supply is clogged and overheating...
Xbox One Power Brick (Day One Edition) Disassembly
There are some more links and details in the Xbox One Turns Itself Off wiki.