The temples are supposed to be places of worship while no evil villain is in control. Though some temples are actually for evil.
In TP, the Forest Temple was like a sanctuary for the primal kokiris (what I call to the monkeys as). In OoT, the Shadow Temple was a place for evil as well as the...