In Book Nine of the poem, we encounter a heroic crisis for Odysseus. While it is clear that Odysseus is smart, this particular section of the poem reveals Odysseus' ego. Because of his hubris, Odysseus is sentenced to a much longer journey than was originally planned.
First, let's look at the actual escape:
First Odysseus waits until Polyphemus leaves the cave to tend to his sheep. He and his sailors find a wooden staff and place the end of it in the fire in order to harden it enough to make it a weapon. When Polyphemus returns to the cave, Odysseus introduces him to the wine the sailors brought from the ship. Polyphemus enjoys the wine, and he and Odysseus begin drinking. During this time, they have a conversation where Odysseus says that his name is "Nobody." (In some translations, it appears as "No One.") When Polyphemus falls asleep, Odysseus and a select group of sailors grab the staff from the fire and jab it into Polyphemus' eye.
The screams from Polyphemus awake his neighbors. They come to his cave to see what is wrong, but Polyphemus yells, "Nobody is killing me!" The neighbors leave assuming everything is fine.
Odysseus and the others still have a problem. A large stone is still blocking the door, and it is clear Polyphemus intends to feel the top of each sheep as it exits the cave to feed in the morning. Odysseus tells his sailors to strap themselves to the undersides of the sheep. This way, Polyphemus only feels the fleece of his sheep and not the sailors as they escape. The ruse works, and the sailors are able to return to the ship.
If Odysseus had simply sailed away from the island, things would have been fine; however, Odysseus decides to taunt Polyphemus. It is clear that Odysseus believes that this deed is something the gods should recognize, because he brags about it with his true name. Polyphemus, enraged, calls upon his father, Poseidon, to punish Odysseus. Poseidon complies. Being a sailor on the bad side of the god of the oceans and seas is not good. Odysseus and his crew find themselves sailing farther and farther away from their home.