The body has an automatic control system to maintain a constant internal environment to ensure that cells can function efficiently. This is called homostatis. It is the maintenance of a constant internal environment.
The body balances inputs and outputs to keep the internal environment steady, e.g. steady temperature, steady water levels and steady carbon dioxide levels in the blood.
Enzymes in the body work best at 37'C, so it's essential that the body remains very close to this temeprature. Heat produced through respiration is used to maintain the body temperature.
If the body temperature becomes too high, blood vessels widen and blood flows closer to the skin so heat can be transferred to the environment. This is also done by sweating - the evaporation of sweat requires heat energy to be removed from the skin.