A sequence of chemical reactions undergone by a compound or class of compounds in a living organism.