Origin of gods

Every god of Greek mythology has its history of origin. Actually, the origin of ancient Greek gods may be learned from two points of view. First point of view deals with mythology and explains appearance of gods according to myths. And another point of view deals with psychology. The origin of gods may be explained through psychological needs of ancient Greeks. These two points of view are common for every nation and every religion.
As for the mythological point of view, gods were born like all other people. Though, the birth of each god was accompanied with some interesting events. For example the supreme god of Olympus was born and hidden away from his home. It was performed in order to save his life. His father Kronos was told that he would be killed by his son, so he ate his kids in order to save his life.
As for origin of gods from the point of view of human's psychology, thing are rather simple here. It was common that people knew nothing about this world and events of this world. Every single day they faced some events produced by nature and they knew nothing about those events. And that is why they were scared about those, so they needed some explanation.
And they managed to find that explanation in personification of those. They created gods who were masters of elements and their lives. And they also developed a number of ceremonies in order to please those gods and so make their own lives safer.