edit: I can see where I was wrong on my view of this, thank you all for the replies.
The Odyssey is a comic epic poem. Comic in the ancient Greek sense did not refer to humor, rather it referred to the ending, which is harmonious (i.e. Odysseus makes it happily home and all is well). Odysseus is a man who strives to return to his former position as basileus (leader) in his village. The Odyssey is the foil to the Iliad. Whereas in the Iliad the main goal is honor and time, in the Odyssey the main goal is acceptance and harmony. Odysseus uses all the tricks in the book to achieve this goal. It is the story of a man who shows the triumph of right over wrong. Odysseus is the hero, who has restored his oikos (household) to harmony in the face of the suitors, who are breaking xenia.
The important concepts to remember are that back in ancient Greece, the customs were different. They see Odysseus as a hero who restored harmony, not as a murderer who killed 100+ people in his own house.
Edit. Barry Powell provides a good analysis in his textbooks.
Who says he is? Sophocles' Ajax, Virgil's Aeneid, Aristophanes' Wasps (arguably) don't necessarily paint him in a great light, and there are definitely points in the Iliad where he doesn't come off smelling of of roses even in context (Book 9). Shakespeare's Troilus and Cressida doesn't exactly make him off as the coolest guy either. Why he may come off looking better as compared to most of the other heroes is sort of a different topic.
What portrayal are you referring to?
Don't mistake the Greek word "hero" for our word "hero." Originally, a hero wasn't a good guy necessarily, just someone who was larger than life, usually a descendant (however distantly) of one or more of the gods.
Odysseus' role in both epics is summed up in his epithet and in the goddess who patronizes him: he is "Clever Odysseus" and he is favored of Athena, the goddess of (for lack of a better term) strategy, but hated of Poseidon, the patron god of horses, the sea, and (significantly) Troy. But ordinary mortals can, at most, be ordinarily clever; Odysseus is heroically Clever.
As reflected throughout a great deal of their mythology, the Greeks valued intelligence a great deal. Specifically, being "Clever" and using human cleverness to overcome divine and natural elements. Odysseus is a good embodiment of Greek humanism as a whole. He used his intelligence and might to overcome anything that came before him, which are traits that all Greek heroes should hold. The focus of the story isn't so much the specific acts that he did, but how he did them that make him a hero.
In Dante's Divine Comedy, he definitely is not. Dante places Odysseus (or Ulisse) in the 8th ring of the 8th circle of hell, reserved for counselors of fraud, who fit as committers of sins of malice.
For anyone interested in this topic, I would highly, highly recommend checking out the free online course The Ancient Greek Hero led by Prof. Gregory Nagy of Harvard, a world-renowned expert on many things ancient Greece, but especially the idea of the hero. The class includes the Iliad, Odyssey, tragic plays, and many more, and is an extremely interesting, very in-depth, very accessible look at what made someone a hero in Ancient Greece. About a quarter of the class is dedicated to the Odyssey, and of course students are free to participate in as much or as little as they like. Some points from the class that are relevant here: