Those types of cpu cooling fans have 3 wires connected to them. 2 wires are for power, the 3rd wire is a tach signal that goes from the fan back to the main board. If the fan isn't running when it is supposed to the tach signal is missing and the main board shuts things down for fear of overheating the cpu. The fan is attached to a heatsink that is attached to the top of the cpu chip. The fan's job is to keep the heatsink cool so it can keep the cpu cool. Sometimes the main board also has a temp sensor mounted near the cpu and it will tell the main board to shut down if the temp is higher than specified. In either case the fan not running is likely the problem.
You will probably need to replace the cpu fan or try to repair it. Sometimes it is just a buildup of dust bunnies keeping the fan blades from turning. Or you can peel off the sticker on the hub and put one drop of light (thin) oil to see if you can get it running again. Replacement cooling fans should be available, you'll need to look at your fan label to see what voltage it uses. It isn't hard to replace the fan. The 4 screws on the fan usually simply screw into the heat sink fins underneath. Just unscrew them and disconnect the fan cable. The heatsink itself is attached to the top of the cpu and usually does not need to be removed.
Of course do all of this with power turned off to the machine. And be careful not to drop a screwdriver or other tool down onto the main board. There are lots of parts and circuit traces that can be damaged.
The fan should have a label identifying the mfr, fan model and voltage. Hopefully you can google a replacement. Or someone with the repair manual for your model machine might have the part number. Otherwise you can try getting one based on voltage and physical size.