|MadSci Network: Biochemistry|
Hi, Louisa, and thanks for your question.
A can swells when it is tainted with botulism because there are anaerobic bacteria growing in the can and their metabolic processes generate carbon dioxide and hydrogen gas, similar to the way our muscles produce CO2 when placed under acute strain. Clostridia bacteria are found naturally in the environment, but only grow in the absence of oxygen. When a food product contains Clostridia spores, but the can isn't sterilized properly, the spores can germinate in the sealed, low-oxygen environment of the can. Once they start growing, anaerobic bacteria produce carbon dioxide and hydrogen gas as they ferment the sugars in the product. Because Clostridia are fairly common in the environment, any type of swelling or other evidence of fermentation of a closed container should be considered dangerous.
There's a short explanation of anaerobic respiration here, and a little bit about the clostridia and the various woes they're responsible for here.
Try the links in the MadSci Library for more information on Biochemistry.