An age old question, answered by many people in many ways. The Torah has much, and little to say on this topic. It is deep waters for spiritual seekers. The problem is once you start thinking on the beginning, many more questions come up which are hard to answer.
So where did it all begin. Before space even existed. YES SPACE. It was created too. Oh, and time, yes, part of the Creation. Energy, matter, all created. Oh, and the heavens, the spiritual realm, created as well. So what came before everything physical and spiritual were created?
Only G~d. Only G~d. Only G~d. Only G~d.
Oh am I repeating myself. G~d is the core, transcendent, not physical. Both loving, caring, and decisive, able to judge between good and bad.
Take a look at the notes and see where they lead you.