God is a mystery unsolved even today, an inexplicable phenomena that just can’t be simply explained through logic and reasoning.
A more subtle and straight explanation says that the necessity to survive led to God praising and creation of God itself. The fear from unknown things, unfamiliar objects provided a foundation to the majestic skyscrapers of superstitious beliefs in god. The innocent human beings from the ancient ages were far less logically evolved to understand the forces of nature. Natural catastrophes caused a fear to develop within their hearts and to counter this fear they had to find a reluctant source of worship which would help them overcome their fears. This belief was merely an instrument to help them become mentally strong against the disastrous forces of nature that would create an obstacle to their survival.
As animals at a moderate stage in the food chain we were bestowed with a belief that predators were always looking for us. And so we believed that something was watching us all the time. When we logically evolved we began to understand that for every positive thing there is a negative counterpart and vice versa. Since we already had a hunch that something bad was watching us, we slowly came to believe that there was something good watching over us all the time too. This belief came purely out of logic. The idea of having a guardian looking over us all the time helped boosting the confidence in adverse time and the tendency to give up on things decreased. we started having better rates of success which gave us more time to think about other things. Other things simply meant better ways to live.