How did Zeus become ruler of the Greek gods?

Zeus' parents were the sibling Titans Kronos and Rhea. Kronos (like his father Uranus before him) had heard a prophecy that one of his sons would dethrone him. He wasn't about to let this happen, so whenever Rhea gave birth, he took the child and swallowed it whole. So it was that their children Hera, Poseidon, Hades, Hestia, and Demeter spent their first years in his belly.

Rhea wasn't too happy about this situation, as you might suppose. So when their sixth child, Zeus, was born, she smuggled him to Crete and gave Kronos a stone wrapped in a blanket. Thinking it was the new child, Kronos gulped the boulder whole and went about his merry way. Zeus was then raised by Nymphs on the island of Crete.

After growing up, Zeus schemed with his mother Rhea to get his siblings back. He forced Kronos to vomit up those siblings he had swallowed, along with the stone that Kronos thought was the baby Zeus. Zeus then led his siblings in revolt and overthrew his father and the Titans, banishing them to Tartarus, which, according to Homer's Iliad, "is as far beneath Hades as Heaven is high above the Earth."

The conquering brothers Zeus, Hades, and Poseidon decided to divide the world among themselves. They drew lots to see who would control what. Hades got the underworld and all the dead folk, Poseidon got the seas and oceans, and Zeus got the skies. Because Zeus was god of the skies, high above any other gods, he also became king of the gods.