During vigorous exercise, when the oxygen supply to muscles is insufficient for aerobic respiration, muscles switch to anaerobic respiration. This process produces ATP rapidly but also generates lactic acid as a byproduct. The accumulation of lactic acid lowers the pH in muscle cells, interfering with muscle contraction and leading to fatigue and soreness.