This is more of a question of psychology than it is philosophy, or even anthropology. The origins of this phenomenon come from man's evolved tendency to assume agency.
Consider in prehistoric times when early man hears a twig breaking, or something rustling in a forest. If he assumes it's a tiger and runs away, he survives whether or not there was actually a Tiger there. If he assumes it's nothing and the tiger eats him, he dies.
What this means is that when we 'hear things', 'hear someone', and this spurs action it's actually beneficial in terms of life outcomes. And so given that fact, our psychology would have evolved to assume agency where there actually is none. And so today what we see are people who attribute things to either living, or celestial beings, when in reality it's nothing.
So if you go back far enough the concept of a creator came from nothing more than people attributing agency to the creation of the universe (or world). The universe is an effect, effects have causes, causes can't come from nothing, therefore an agent created this, therefore God.
From that point on all it takes for new kinds of Gods and religions to arise are new people or communities with different ideas about creation and theology.
So you could say that religion and God are actually unnecessary by-products of one of our important survival instincts.
Going a bit further than that (I've studied religion fairly extensively), I'd argue that the different kinds of religion that have arisen essentially represent the various metaphysical possibilities that people could conjure up.
e.g. God, Many Gods, No God