From other living microorganisms — from spores and cells that were already present in the air, in dust, in water or on the surface. They are never produced by the non-living food itself.
Why we are sure: for a long time people believed in spontaneous generation — that maggots arose from meat and moulds from bread. Louis Pasteur settled the question by experiment. He showed that a nutrient broth stays clear indefinitely if microorganisms from the air are kept out of it, and clouds over as soon as they are allowed in. So new life always comes from pre-existing life. From this came his germ theory of disease — that particular microorganisms cause particular diseases — and support for the cell theory, that all cells arise from pre-existing cells.
What follows from it in daily life: if microbes always come from outside, then keeping them out, or killing the ones already present, must preserve food and prevent infection. That is why we boil water, pressure-cook and sterilise surgical instruments, and why a hospital insists on sterile dressings.
Tip: notice how carefully Activity 11.3 is designed around this idea. The cotton and tissue are moistened with pre-boiled water, so the water carries no live microbes. Any mould that then grows on the bread can only have come from the air — the activity is a small Pasteur experiment of your own.