Muscular cramps occur because of formation of lactic acid in the muscles as a result of anaerobic respiration. When supply of oxygen is insufficient to our muscles during strenuous physical activities, muscles undergo anaerobic respiration. This anaerobic respiration results in partial breakdown of glucose into lactic acid and causes muscle cramps.
We get relief from muscular cramps after a hot water bath or a massage. It is because it improves the blood circulation, thereby improving the supply of oxygen to the muscles. As the supply of oxygen increases, lactic acid breaks down completely to release energy along with carbon dioxide and water. As a result, the muscles relax and the cramps get relieved.