When humans face the unknown, they often feel "fear." This state of being "beyond one's conscious understanding" actually implies "danger."
If everything in the world is unresolved, if nothing can guarantee that one won't lose the ability to breathe tomorrow, if there exists something that might make one's upcoming hunt a total loss...
Humans, who have just gained the ability to think, began to fear such matters.
The brain circuits originally used to recognize and exchange information with others would, driven by this fear, attempt to identify the "emotions" within the vast "unknown."
Of course, they wouldn't succeed in identifying them. This is essentially just a genetic-level bug.
However, just as humans use imagination to compensate for visual shortcomings, they would imagine a supernatural being that did not originally exist, one that thinks like a person, to explain everything and provide a void assurance to comfort them.
Humans thus imagined "God."