A.Odysseus is arrogant and vain.
Odysseus' choice to tell the Cyclops his name is so that he can gain recognition as the person who outsmarted and escaped a Cyclops' lair. He has no other reason to tell his name other than for his own pride and recognition. Because he reveals his identity, Poseidon, the Cyclops' father, takes revenge on Odysseus by keeping him from being able to return home to his family. It isn't until Odysseus admits his arrogance and humbles himself to Poseidon that Poseidon allows him to return home.