Mold requires moisture to grow, thus "moist places". Too much heat cooks it and it dies.
Sunlight provides heat which helps dry things out. The UV radiation is considered to be sanitizing beyond the heat effect. Dark areas are usually cooler with little or no UV exposure.
Different types of mold can grow in different ways. They have tiny spores which can reproduce themselves through sexual or asexual reproduction. In sexual reproduction, these molds spore needs another spore to reproduce, while in asexual reproduction, a single spore can reproduce by itself. They can reproduce themselves almost anywhere. These can grow in soil, on roofs and even in the air, but they grow most rapidly in dark and moist places because their reproduction mechanism works faster.
You kinda of answered your own question. Moist and dark, also cool are ideal breeding grounds for mold and bacterialal spores. Conditions make it easier and faster for them to reproduce and form mold.