Let us go back in time.
Once upon a time, the human being evolved over time. Let us not go into the religious theories at present. That will only create more controversies.
I am a Hindu and so I have been taught about Gods and how the first man 'Manu' was created and so on. The Christians have Adam and Eve and I am not sure what other religions teach.
So, back to your question.
The human was first a cave man during the stone age. He settled down, in societies shortly after, discovered fire and so on.
Man was always awed by the force of nature. So, he began to worship nature. The sun, moon, trees and even animals were worshiped.
As time passed by, human settlements began to have tribal leaders. These leaders discovered that man was also afraid of nature and the gods whom they worshiped. So, in order to control the wild nature of man, religion was used as a weapon to control masses.
Major religions took shape after the arrival of prophets. There were numerous trials and punishments but the priests finally gained control and thus defined rules which were used to prevent straying.
Sometimes I think religious leaders have gone beyond control and people have lost sight of the actual principles behind every religion. That is however just my opinion only.
It would be better if people realize that the message behind each religion is pure love and not hate.
LOVE IS GOD