Hamlet is on his way to England. More specifically, he's on the Danish coast near the Danish castle.
And what does he see but the armies of Prince Fortinbras of Norway, who it seems has decided to wage war with Poland instead of with Denmark.
Hamlet assumes Fortinbras must be taking on the whole country, but after talking with one of his Captains he learns that this is a huge conflict being waged over a tiny, unimportant piece of territory.
This makes Hamlet think. He concludes that, if Fortinbras can lead 20,000 men to their death over a little patch of land, then he should be able to rain vengeance upon the man who has killed his father and "stained" his mother.
He swears to follow Fortinbras' example, stop delaying and finally carry out his revenge.