The most likely cause is simple: your exhaust fan may need cleaning out.
Games are the most demanding thing most people run, so they push the CPU and GPU to full load for extended periods. That is exactly when a machine with restricted airflow stops keeping up. Dust mats against the vents and clogs the fan blades, and once airflow drops the components heat up and the system throttles or shuts down to protect itself.
So open it up and clear the dust — from the fan, the heatsink fins, and the vents. A can of compressed air held so the fan does not spin freely is the usual approach.
If cleaning does not fix it, work outward from there. Check that the machine has clearance around its vents rather than being pushed against a wall or sitting on soft fabric. Listen for whether the fan is actually spinning. And if the hardware is old, the thermal paste between the heatsink and the chip dries out over the years and is worth replacing, since that single layer is what moves heat away from the processor in the first place.