I always thought this was something to do with lactic acid. If your muscles are working very hard, then they start to respire anareobically – they start to break down glucose without using oxygen. One of the by-products of this is lactic acid. This builds up the acid in the muscle cells, which you might feel as a burning sensation. Your body’s warning you to take a break. I would have thought that if you let the acid build up too much, it wouldn’t be good for your muscles.
Turns out that might not be the whole story. Very high performance athletes seem to be able to train their muscles to metabolise lactic acid – to break it down if the muscles are working too quickly. But possibly a bit beyond my fitness range.