Magic in 5e comes from the Weave, which is a balanced fabric of light and dark magic. When Selune and Shar, the original goddesses of Light and Dark, engaged in a bitter battle, their essences mixed to create Mystyrl and the Weave. The Weave separated raw magic from normal waking life and let casters tap into it.