There are many reasons why your laptop is wanting to shut down.
The first reason is most likely the most likely - it is probably getting old and needs to be replaced.
The second reason is also most likely - it overheated before and the laptop shuts down to keep it from overheating again
The third reason is malware... I shouldn't explain further, because I hope you know what's malware. XD