Answer: Mushrooms are a fungus and they grow from spores. Fungal spores are airborne and can settle onto surfaces. If the surface is nutrient rich and moist (such as your potting soil) the spores will grow into mushrooms. Since they're already in the air in your house, they only way to keep them from growing in your potting soil is to either allow the top of the soil to dry out between waterings, or place sand or gravel on the soil surface to keep the spores from finding a moist surface.
Best wishes with your houseplant collection.
Q&A Library Searching Tips