According to Babylonian myths, Marduk was not always the head god. At one time, all the gods were equal. But there was fighting amongst the gods. One in particular, Tiamat, was evil and hated the rest of the gods. Now Tiamut was very powerful and the other gods were afraid of her.
One of the other gods developed a plan. Ea, the water god, knew that Marduk could defeat Tiamut. So Ea went to Marduk and asked if he would be willing to fight Tiamut.
Marduk thought about it. While he figured he could beat Tiamat, what if something went wrong? What if she captured him or even killed him? It had to be worth his efforts. So Marduk came back to Ea with a deal. He would fight Taimat if the rest of the gods would make him the head god forever.
Ea could not make that deal on his own. He had to get the rest of the gods to agree and he knew that some of them would oppose this idea, some because they were afraid of what would happen if Tiamat won and others because they didn't want another god to be able to boss them around. But Ea was a very smart god. He had a plan.
Ea called all the gods together in an assembly. Ea provided the food, entertainment, and most of all the sweet, strong date wine so many of the gods loved. After allowing the rest of the gods to feast and drink lots of date wine, Ea put the idea to them. They agreed. So Ea went back to Marduk and let him know that if Marduk defeated Tiamat he would be the head god forever.
Marduk took a bow and arrows, his thunder club, his storm net, and his trademark - a lightning dagger - and set out to defeat Tiamat. The fighting that followed was stupendous. The battle raged for days with Marduk killing monster and demon left and right. Finally he got close enough to Tiamat that he was able to throw his net over her. Trapped, Tiamat turned to destroy Marduk with a magical killing scream. Marduk was faster and shot an arrow down her throat killing her. He then cut her body in half and put half of it in the heavens guarded by the twinkling lights we call stars and made sure that the moon was there to watch over her. The rest he turned into the earth.
Now that Tiamat was dead, Marduk was the leader of all the gods.
It is interesting to note that Marduk had to get the consent of the assembly of gods to take on Tiamat. This is a reflection of how the people of Babylon governed themselves. The government of the gods was arranged in the same way as the government of the people. All the gods reported to Marduk just as all the nobles reported to the king. And Marduk had to listen to the assembly of gods just as the king had to listen to the assembly of people.