Difficult. Could you rephrase? Are you asking why humanity invented/needed a god, or how/when the first deity "appeared"? We need more substance in the question, I think.
Since you have now rephrased the question, I will add my contribution. The "universe we know" and all that is in it, is difficult to understand and explain given the sum of human knowledge. It IS easy to explain (and lazy) if you postulate the existence of a supreme being to create it.
Mankind has been fearful of death as soon as he realized that it comes to us all, unerringly. Don't like the idea of death? Invent an afterlife. To make that easier, invent a deity too.
I'm not denying the existence of a god, I'm not anything like as infallible as (s)he is. But religion, in most of its forms, is a result of intellectual laziness.