Irregular or sporadic cycling causes muscle cramps because there is a deficiency of oxygen in the muscle cells. As most of the oxygen is being used up during cycling. As a resultthe muscles undergo anaerobic respiration to provide energy to the body. Anaerobic respiration leads to the production of lactic acid. 

1 1 1