Odysseus runs into trouble with the gods in a variety of ways. He is kidnapped by Calypso and held captive for many years. He is shipwrecked. He and his men have to face, and escape from, Circe and other interesting monsters and mythological creatures.
However, the biggest mistake that Odysseus has made, it seems, is making Poseidon mad. When Odysseus and his men come ashore on the island of the Cyclopses, some of them are captured by the Cyclopes called Polyphemus, who holds them in a cave. After the monster starts to eat Odysseus' men, Odysseus comes up with a plan to blind Polyphemus so they can win their freedom and leave the island.
When the men finally return to their ship, the blinded Polyphemus finds his way, angry and humiliated, to the shore. Instead of just leaving, and acting like a hero, which is usually his practice (afterall, he has proven himself in the Trojan War), he taunts Polyphemus, who then tries to sink Odysseus' ship by throwing boulders in the direction of the hero's voice.
Because of Odysseus' undignified behavior, Polyphemus calls on his father (Poseidon) to punish Odysseus, and Poseidon creates further obstacles that will keep Odysseus from arriving home for many more years to come. (And because his men anger the gods by eating Helios' cattle, they are destroyed and never return home.)