Lactic acid is, to some extent, the carbon monoxide of the internal combustion engine that is our muscles.
Allow me to clarify. When your muscles are burning working efficiently, there is plenty of oxygen getting to your muscles. This allows your body to make energy efficiently. This is generally referred to as aerobic exercise. Aerobic exercise can be maintained for a long time, but doesn't produce a large amount of energy. Examples of aerobic exercise include distance running, biking, or any other activity where the people who are doing it don't look like they are huffing and puffing. If they are, then it is another case altogether.
When the body works harder than it usually does, or needs more energy, it is called anaerobic exercise. In this case, the body is not getting enough oxygen to burn its fuel efficiently, and thus, a waste product is made. This waste product is lactic acid. And it is not fun. Lactic acid is what makes your legs feel like they are about to fall off after running repeats. It's also what makes it hard to wash your arms in the shower after lifting weights.
In a car's engine, if combustion occurs with limited supplies of oxygen, or if the oxygen simply doesn't circulate enough, the product will be carbon monoxide, not carbon dioxide. In your muscles, if they don't get enough oxygen from the bloodstream, and the energy demanded is great enough, lactic acid is produced as a byproduct.
So, in conclusion, lactic acid is the product of an overworked body. Sometimes this is the desired effect, sometimes it isn't. But whether you want it or not, it hurts.
Disclaimer: of course this analogy isn't perfect, but it does give the basic idea of why lactic acid forms. And of course, lactic acid and carbon monoxide are both hurtful, to some extent.
6-1-02: WolfKeeper says Re: lactic acid is also a fuel your body can burn. If you do lots of anaerobic followed by aerobic, your muscles burn it. In fact you can train this up.