Bread gets moldy because it provides a good source of food for some types of fungus. The air is usually full of tiny mold spores, and under the right conditions, they can settle on nearly any organic substance and start to digest it. In bread, these enzymes break down the cell walls of the organic material making up the loaf, releasing easily digestible, molecularly simple compounds. This is how bread gets moldy.
Mold, found on old or unrefrigerated bread, comes from fungi, one of the most ubiquitous and successful forms of life on the planet. There are dozens of thousands of species, which can be found practically everywhere. Scientists who study fungi, called mycologists, say that approximately one out of every 20 living species is a form of fungus.
Fungi cannot receive energy directly from the sun because they do not have chlorophyll, and must therefore live off other plants and animals. Some fungi are parasites, actively attacking a host for nutrients. Most, however, are scavengers, turning organic matter into soil. Without fungi, many plants would die, because they require rich soil to thrive.
Most fungi tend to be flexible about their food choices. They feed on a wide variety of organic molecules, and their flexibility is largely responsible for their ubiquity. Fungi produce dozens of digestive enzymes and acids, which they secrete into a material as they grow over it.
Unlike humans, mold digests first, then eats, rather than vice versa. Under the right conditions, there exist forms of fungi that eat practically anything but metal. Special fungi produced through selective breeding are sometimes used as agents to target specific compounds for cleanup.
Fungi reproduce exponentially until all available nutrients are exhausted. Some forms of mold can double their mass every hour. They reproduce by means of spores, tiny vectors which are produced by the fungus en masse. Spores are extremely small and numerous — there are probably millions of fungal spores in any room at one time.
Luckily, these spores can be destroyed by cooking, which is why bread doesn't immediately get infected with mold. Over time, however, airborne spores find their way onto the nutrient-rich surface of bread and start multiplying — even under the cold conditions of a refrigerator. At freezing point, fungi become dormant. If they are exposed to heat again, they can revive and continue to grow.