The allusion in the passage is to Nemean , the lion in Greek mythology which was also a malicious monster.The lion was killed by the brave hands of Hercules.He was the only being who could do that as the lion was not to be killed by the hands of a human being.On seeing that he has to face the semi god Hercules, the lion knows he is about to be killed and no matter how hard he pulls out a fight, that is his fate.
Hamlet is the heir to the throne, he is well aware of that. He uses the image of Nemean because he knows he is about to be defeated, he knows his position of power.Shakespeare uses the allusion , then, to show that Hamlet is certain about his destiny and also because , in some sense, Hamlet feels he is being malicious and deserves to die while pulling out a fight.