This famous phrase from Act I, Scene 4, appears at line 90: "Something is rotten in the state of Denmark." In Scene 2, Horatio tells Hamlet that the guardsmen have seen what they believe to be the ghost of Hamlet's father for the last two nights. In Scene 4, Hamlet goes to check it out. Soon after the stroke of midnight, the ghost appears and bids Hamlet to follow him. The two guardsmen on duty, Horatio and Marcellus, try to convince Hamlet not to follow. Hamlet tells them to go away, that he will follow the ghost.
Marcellus: Let's follow. 'Tis not fit thus to obey him.
Horatio: Have after! To what issue will this come?
Marcellus: Something is rotten in the state of Denmark.
Horatio: Heaven will direct it.
Marcellus: Nay, let's follow him.
On the surface, Marcellus's final comment simply states "Let's trail Hamlet as he follows the ghost." But this comes right after Horatio's statement that, essentially, heaven will make sure Denmark is okay. On the tail of Horatio's comment, Marcellus also seems to be stating that he would rather follow Hamlet than leave Denmark in heaven's hands.
This foreshadows the main conflict found throughout Hamlet: Hamlet's sense of honor pulls him in opposite directions. On one hand, his honor as a son dictates that Hamlet should avenge his father's death and kill his murderous uncle Claudius; on the other hand, his honor as a citizen of Denmark and a member of the royal family dictates that he should uphold the divine right of kings and leave Claudius alone.