Decomposition, or "rotting", is what happens to living things when they die. It also happens to organic material of any kind, such as foodstuffs. The reason it happens is that organic molecules are stores of building blocks and energy. Whatever breaks down organic material uses the energy and building blocks to reproduce itself.