It is the cooler's fault for the shutdown process. While you're playing games, the CPU and the GPU gain more heat which needs to cool down and since the cooler is faulty all the heat dissipates to a much lower rate than using a good working cooler. You will need to take the laptop to a service shop and ask for a technician to take a look at it because if you continue to keep using it like this, the laptop will become more and more unresponsive.