One possible cause of this problem is overheating, which can have many causes. However, if your Windows 11/10 computer shuts down randomly but is not overheating, take these steps to fix the issue ...
Windows 11 shutdown bug explained with causes, fixes, and workarounds to stop restarts, battery drain, and failed power-offs after updates.