Scientists do not yet understand exactly what causes muscle soreness, but it likely results from the combination of stretched or torn muscle fibers, swelling and lactic acid accumulation. While lactic acid does play a part in the muscle pain and soreness that follows exercise, it is not the sole cause as was thought for decades. Soreness is not correlated with the degree of exercise performed or with gains in strength.
Lactic acid is a byproduct of lactic acid fermentation, and muscles use the process to power muscles when the animal cannot supply enough oxygen to the muscles. Lactic acid fermentation is an anaerobic process, and although it is not as efficient as oxidative metabolism, it can keep muscles functioning long after an organism suffers an oxygen debt.
Whenever muscles work hard, they incur very small tears. This is normal, and part of the body's growth strategy. When muscles tear, the body builds them back stronger than they originally were. This is how resistance training causes muscles to grow.
After exercise, many people experience swelling in the muscles that they used. Tests in the 1980s linked swelling with soreness, but only a few forms of exercise were tested in the study.