The cave in a dream represents a safe place, but due to that also a dangerous place if we stay in its zone of comfort.
The symbolism of the cave usually indicates the womb, i.e. the primordial, safe space, the center of the maternal complex.
If a dreamer stay in a safety of a cave – mother complex, nothing will happen to him/her, but she/he will not live either. So the idea of the cave is about overcoming the attraction of the safety of our comfort zone and go out of it and individuate – by the help of the male energy.
The female world is ruled by the moon, so it is dark as in a cave, and the male world is ruled by the sun, so it is bright.