The autonomous nervous system controls the nervous system, normally by the constant input of the parasympathetic nervous system that keeps the heart rate down. The more active the parasympathetic nervous system input is, the slower the heart beats. The heart has its own pacemaker that the central nervous system adjusts.
With normal levels of activity, the parasympathetic nervous system controls the heart rate. In periods of high stress or activity, however, the sympathetic nervous system affects the natural pacemaker to increase the heart rate beyond normal. The nerves that perform this task are known as accelerator nerves. The control for both the sympathetic and the parasympathetic nerves going to the heart is in the brain's medulla.
The body determines what the heart rate should be based on several factors. The chemistry of the blood has a strong effect. Decreased oxygen levels lead to an increased heart rate as do increased carbon dioxide, hydrogen ion or lactic acid levels. The heart rate also increases in response to strong emotions or the anticipation of exercise via the limbic system. An increase in body temperature also can increase heart rate. Thyroid hormone levels affect general heart rate with higher levels leading to an increased rate.