If it's not an overheating problem, then I think it's either
faulty settings, corrupt software or damaged, disconnected or faulty hardware like the power supply
unit (PSU).
Does the shutting down happen suddenly?
How often does it happen?
Ok do this:
Switch on your computer and while it starts up,
tap the F8 button on your keyboard until you get a list of options
and select the Safe Mode With Networking option.
Then download and install Malwarebytes
Download the free version:
https://www.malwarebytes.org/dl-confirm/
After installing it, let it update, and then run a scan and change the
settings to include scanning for rootkits, memory objects and registry.
After ticking all those settings (scan for rootkits, memory objects and registry)
you need to then start a full scan.
It probably take a long time so just wait for it to finish.
After it's done, you can make it remove the viruses that it finds.
After that, restart your computer but in normal mode.
If the shutting down problem is fixed,
do another Malwarebytes scan in normal mode this time to remove more
possible viruses.
Doing this will find out if it's a virus problem or something else.
If after all this, it still doesn't work, then do this:
Switch on your computer and tap the F10 or maybe F12 button on your keyboard
to get to the BIOS.
Set your BIOS settings to default and restart your computer.
If the problem still happens, then switch off your computer.
Then UNplug your computer from the wall socket (to make sure you don't get an electric shock)
and check all the connections of your PSU/power supply unit are correctly pushed in.
Check everything else too like RAM, graphics card, etc.
(Have you tried putting in a different graphics card to test?)
If it's all connected properly, then you might need to buy a new PSU.
Or you can maybe ask a computer technician or computer shop to check if
it's actually a PSU problem.
I don't know what wattage/power rating your PSU should be.
I don't know much about PSUs, sorry.
I hope that helps.
It could also be power settings but I don't know...maybe default settings in power options
in the control panel in Windows might fix it.
Remember to NEVER open your computer when it's on
or connected to the wall socket.
Your computer needs to be UNplugged from electricity to avoid electric shocks.
If you have questions, let me know.