Overall, Hamlet and Fortinbras are foils. Both men are sons whose fathers have died. Each wants to avenge his father's death. However, the big difference is that Hamlet is seized by doubt at every turn, questioning whether the ghost is really his father's or something evil, bent on destroying his immortal soul. Therefore, he does not act.
Fortinbras, on the other hand, wages war against Denmark as he tries to take back land that he feels Old Hamlet took from his own father unfairly. However, when he is ordered by his uncle to cease trying to take the land forcibly, he is honorable, bows to his uncle's will, and stops fighting.
To be fair to Hamlet, he does not listen to his uncle, the new king, because he believes Claudius has murdered his father. Fortinbras' uncle is an honorable man, and the throne has come to him honestly upon his brother's death. If he wanted to, Fortinbras could have ignored his uncle (Old Norway) and continued because Hamlet's father killed Fortinbras' father in battle, but Fortinbras takes his uncle's direction.
In addition, Claudius has married Hamlet's mother (which Elizabethans would have seen as incest), and he has done so too soon after Old Hamlet's death (primarily to solidify his place on the throne, though he also seems genuinely attracted to Gertrude), and Hamlet has nothing but disdain for his uncle/stepfather and his mother Gertrude.
Specifically in Act IV, scene iv, a chance meeting between Hamlet and Fortinbras's army gives Hamlet pause for reflection:
Hamlet and Fortinbras' captain discuss the goals of Fortinbras' army. The captain tells Hamlet that they are making war to reclaim a small piece of land, which is not actually worth much. Hamlet is stunned that Fortinbras is willing to risk so many men's lives over something that matters so little. He compares this to his own inability to kill Claudius, despite the fact that his father has been murdered and his mother seduced. He decides to start acting on his vengeful feelings.