These are two intriguing characters to compare and contrast because they are so profoundly different. Horatio serves as Hamlet's confidant. He is the scholar, the loyal friend, the one character in the play who is not "passion's slave." As the skeptic of the ghost in the first act, Horatio acknowledges the ghost's reality and informs Hamlet about the ghost's appearance. When he learns the truth of his father's murder, Hamlet confides in Horatio telling him that he will put on an "antic disposition." Later in Act 3, Hamlet uses Horatio to verify his own assessment of Claudius' response to the play-within-a-play. Horatio also is present at the graveyard scene when Hamlet muses about the physical effects of death in the form of Yorick's skull. So, it is not surprising that the dying Hamlet chooses Horatio to tell his story. Horatio provides Hamlet with his one true ally amidst the rampant corruption in the court. His spotting of the ghost shows Hamlet he is not delusional, and later Horatio's assessment of Claudius' reaction to the play confirms Hamlet's own judgment: Claudius is indeed guilty of the murder of his brother. Gertrude betrays her son by marrying Claudius, Ophelia obeys her father who pits her against Hamlet, his childhood friends Rosencrantz and Guildenstern become spies for the king, but Horatio remains loyal and steady throughout. The best passage that shows Hamlet's feelings toward Horatio occurs in Act 3, scene 2, before the play-within-a-play, which Hamlet begins with "Nay, do not think I flatter."
Polonius is, in many ways, the antithesis of Horatio. He represents the "candied tongue that lick[s] absurd pomp,/And crook[s] the pregnant hinges of the knee/Where thrift may follow fawning." Whereas Horatio's loyalties lie with Hamlet, Polonius sides with the king. But Polonius' loyalties are self-serving. He will go to great lengths to curry favor with the king--even to the point of sacrificing the privacy and dignity of his daughter. Hamlet calls him Jephtha, an Old Testament character, who sacrificed his daughter for military success. Unlike Horatio who tells the truth, Polonius engages in spying and lying. A comic example is Polonius' conversation with Hamlet after the play scene, in which Polonius agrees that a cloud looks like a camel, weasel, and whale--essentially agreeing with whatever Hamlet says, hoping to pump Hamlet for information that he can relay to the king. Polonius presents for Hamlet one more corrupted individual that he must maneuver around, a feat that the brilliant Hamlet does quite well. However, Polonius is a real threat. Polonius's control of his daughter is something that Hamlet cannot prevent. Polonius drives a wedge between Ophelia and Hamlet, causing their relationship to splinter. Polonius's death also is devastating to Hamlet. Hamlet's killing Polonius puts Hamlet on the defense and Claudius on offense, curtailing any hope of Hamlet's achieving the vengeance he desires --until Act 5. Claudius, immediately after Polonius' death, sends Hamlet to England with secret orders that he be executed.
Horatio through his intelligence, loyalty, calmness provides Hamlet with the support he needs when others have abandoned him; Polonius through his bumbling, self-serving, and dishonorable practices serves to thwart Hamlet's relationship with Ophelia and delay Hamlet's revenge on Claudius.