Hello,
It can be that the CPU is overheating or problems with RAM. If you have multiple RAM sticks, remove all of them. Then use the computer with one stick, if it shuts down, try the next one. This is what I would do first, if I don't find any issues with memory sticks, then check the CPU and the FAN, make sure the FAN is working. Usually if the fan is not working the processor overheats and shuts down the PC, but it is good to at least check the FAN.