It sounds like it could be a malfunctioning fan on the power supply which is causing the power supply to over heat, which can cause a computer to shut down unexpectedly. maybe get the power supply tested, and if it is faulty i would strongly suggest replacing it asap. because it will start to damage other components of the PC and can become costly to fix.
And if the power supply is working 100% then the next possibility is either, issues with a driver and or malware and for that i would suggest running a diagnostics on your pc and take it from there.
I hope this helps you in resolving your problem and please let me know of the outcome.
Thanks