What causes the heart to beat fast when a person is frightened?
Increased secretion of adrenaline hormone
The fight and flight response basically - the adrenal glands near the kidneys secrete more adrenaline hormone which has a number of physiological effects including making the heart beat faster hence raising the blood pressure and availability of oxygen to the cells and muscles, sweating, dilated pupils, etc.
This all assists the person to fight off the perceived danger or threat.
(However, if this occurs too frequently as in long term stress, it can have an adverse effect on the human body and can cause chronic illness).