On Windows 11 (or if you are still running Windows 10), you can use these three ways to find out why the computer shut down unexpectedly using the system event logs.
Windows 10 Is Not Shutting Down? Here's How to Fix It! - EaseUS
How to Shut Down the PC in 7 Ways
Shutdown/Restart Windows using Command Prompt and PowerShell
How to Find the Cause of an Unexpected Shutdown on Windows 10 [Tutorial]
How to Fix Blue Screen of Death (BSoD) Errors in Windows
7 Ways to Turn off a Windows 10 or 11 Computer - MajorGeeks
Random Shutdowns on Windows 11 Keep Popping up? Fix Guide
Solved] Kernel Power 41 Critical Error on Windows 11/10 - Driver Easy
8 Easy Ways to Shut Down Your Windows PC