It is a VERY hard subject! God was there before EVERYTHING else and will be there after everything is gone and will be there forever the earth is relatively new maybe just poof and he was there or maybe over years and years he just kinda formed. We don't know the bible just says he has always been there and will forever be there.
It is written: John 1:1 In the beginning was the Word, and the Word was with, and the Word was God. The same was in the beginning with God. All things were made by Him: and without Him was not any thing made That was made.
God was made because there was a necessity for a divine commander. He was first verbally introduced to the slaves in order to make even the defiant ones obey. Then as the concept evolved they began to write stories and eventually write a slaves hand book. As the plantation grew and people rejected the ugly name they renamed it the holy bible. Of course there was universe before god, god is a tool to control slaves not a real creator.
Everything we observe in nature has a beginning. God however is in a different category, in that he has always existed, independent from anything he created. God is not a dependent being, but self-sufficient, self-existent. And this is exactly how the Bible describes God, and how God has revealed himself to be. Why must God be this way? Our universe cannot be explained any other way. It could not have created itself. It has not always existed. And it could not be created by something that itself is created. Why not? It isn't coherent to argue that the universe was created by God, but God was in turn created by God to the second power, who was in turn created by God to the third power, and so on. As Aristotle cogently argued, there must be a reality that causes but is itself uncaused (or, a being that moves but is itself unmoved). Why? Because if there is an infinite regression of causes, then by definition the whole process could never begin.http://www.everystudent.com/wires/created.htm
One of the most asked questions in the world is, 'Where did God come from?' The answer, to us Christians, is that God has always been here. No one invented Him, or made him - this is very clear to those of us who have studied the nature of God. One would ask, 'How did God create Himself?' He didn't create Himself, and He has always existed. Creation means to make something from nothing. To create something requires that the creator exist before the thing created. When a carpenter makes a table, for example, he exists before the table he makes. For God to create Himself, He would have to exist before Himself, which does not make any sense. God could not have been created by someone else, because then God's creator would be greater than God. And that does not make any sense because God is the Supreme (or highest) Being, and you cannot go any higher than the highest. When Moses asked God at the burning bush what His name was, He responded "I Am who I Am" which indicates that God is existence (or "being") itself.