Your body is an incredibly efficient machine that constantly adapts its outputs to match the requirements of its environment. Placing your body under stress, whether psychological or physiological, will naturally cause an upswing in nutrient delivery and general preparedness, as the body readies itself to potentially fight for your life. One of the main subsystems of the body so affected is heart rate, and one of the main stimuli affecting heart rate is exercise.
Generally speaking, your heart rate is nothing more than the number of times your heart must beat per minute to successfully pump blood throughout the body. Understand that your heart is as much a muscle as your bicep--it can be trained and conditioned to become stronger or it can be allowed to grow weak and atrophy. Regular exercise is one of the best ways to promote heart health, as exercise forces the heart to work harder than it normally would.
Exercise and Heart Rate
When presented with a training stimulus (or even the thought of a training stimulus), your heart rate will naturally begin to increase. This is the body's way of preparing for a stressful situation where its survival might be called into question. Understand that your body cannot differentiate between running around a track and running from a hungry lion--both are situations equally deserving of a rapid increase in heart rate to prepare it to "survive" the encounter.
Increasing Nutrient Delivery
The reason why your heart needs to beat faster as the physical demands on the body increase has to do with the concept of sufficiency. Generally speaking, your body only wants to perform the minimum amount of work to complete a task. When sitting around watching television, your organs and tissues do not require that much oxygen to continue functioning. Thus, your heart will beat slowly, conserving its strength. To the contrary, when exercising, your body requires much more oxygen to keep your body moving at rapid rate--causing your heart to speed up to meet the demands.
Regular Exercise and Heart Rate
If you were to consistently wear a heart rate monitor while exercising, you would notice that, over time, your average heart rate during exercise will decrease. This is due to the principle of SAID, or specific adaptation to imposed demands. Being efficient (and lazy), your body will constantly look for the easiest way to accomplish a task. If you "teach" your body that it will often be required to increase blood flow due to regular exercise, your heart will eventually become more efficient at accomplishing the task at hand--pumping more blood with fewer beats.
A final reason that your heart rate increases during exercise is because your core body temperature is also on the rise. As your body increases in temperature, your heart rate will correspondingly increase in the rate of your heartbeat. Like heart rate increases from an increased demand for oxygen, this effect will also be compensated for over time, as your body becomes more accustomed to operating at a warmer temperature.