If you were to Google the origin of religion, you will find text that states the belief in the afterlife occurred around the time that mankind began having self realization, or conscious thought. What this means is, that once man realized that he lives and dies, he separated himself from the animal world. Animals do not know that death is looming. Religion was born from the collective anxiety created by self realization? Once man realized his days are numbered and death was inevitable, the anxiety about what happens when you die became so profound, that religion was born. The story of a creator who created the heaven and the earth and all life and that after we die we are granted eternal life with our creator, is a whole lot more comforting than we rot in the cold earth. This is just a theory of the development of religion.