Lactic acid buildup when you’re exercising causes a build up of oxygen. Your body cannot break down glucose in the blood. So, your heart beat increases because there is more oxygen than normal needing to be pumped throughout the body.
In short terms: because your heart needs to pump more oxygen, it is pumping faster causing a faster heart rate.