Could be a range of things...
Assuming that the computer is running fine when its on then it sounds like a hardware problem, most probably overheating. I would disconnect the power, open up the case (not as scary as it sounds) and try and remove as much of the dust and fluff that builds up inside computers. If you can get a can of compressed air (Maplin air duster) and blow the fluff off the CPU fans, through your power supply unit (big hot thing near the top with the power leads coming to the components in the case) and generally give it a clean out. I would then connect the power and try and restart the computer and LOOK to see if the fans turn OK. If all looks OK slap the case side back on and you might notice a difference.
Others may have suitable suggestions.
Woppa