Many new computers monitor the operating temp of their CPU. If the temp starts to get too high they begin to reduce the voltage and thus lower the temp. Yours may be automatically shutting down when maximum temp is reached. You should be able to access the current temp by looking at your BIOS settings during start up but do not mess with the settings unless you feel confident with your skills.

The fan could be the problem. I had a heat and fan issue on one of my computers a while back but having an older BIOS the computer functioned up to the “blue screen of death” phase.

Good luck