Testicles hang outside the body. They are protected by a sack-like enclosure called the scrotum. The ideal temperature for sperm production is one to two degrees lower than the typical body temperature. By hanging outside the body, the testicles can be brought closer to the body (if more heat is needed) or lowered (if they need to be cooled).
Some guys may complain about a great deal of perspiration in the genital area. This is just another way the body ensures the testicles are kept cool enough for good sperm production.
The raising and lowering of testicles is called the cremasteric reflex. The cremasteric muscles often move the testicles naturally, but a male can actually control the movement by tensing or relaxing his stomach muscles.