Answer: Excessive soil moisture from overwatering may contribute to the problem. However, there can be mushrooms in potting soil even if you don't overwater.
Most commercial potting soils contain compost. The compost may be from many sources, but in every case fungi are part of the composting process. If the compost was properly made, the fungi should be no problem. The fungi in the potting soil should not infect your plants. The fungi are just continuing the process of decomposing the organic material in the soil to form humus and humic acids. If the soil was not properly heat treated during composting or afterwards, the quantity of active fungi will be very high. When the potting soil bag was opened new fungi could have been introduced to the soil. It would then reinfest, and fungi can grow in the potting soil.
You can use the potting soil outdoors without problem. As a matter of fact, the mushrooms may not grow if the soil dries out a bit between waterings. Best wishes with your garden.
Q&A Library Searching Tips