Shakespeare’s Hamlet, as with much of his work, is replete with instances of duplicity and hidden motives. In Act I of the play, the young prince has been made aware through his encounter with the ghost of his dead father that the latter’s death was an act of murder perpetrated by his brother and successor to the throne, King Claudius, and that the apparition demands justice. Thus begins a complicated tale of sorrow and revenge, in which suspicions, even among friends, dominate the content of dialogue. In Act II, Claudius and his queen, Gertrude, Hamlet’s mother, lament the state of despair in which Hamlet has descended since his father’s death – a state that appears to be worsening. In an effort at ascertaining the entire cause of the prince’s depression and what they perceive to be his descent into madness, the king and queen dispatch two of Hamlet’s friends and confidants, Rosencrantz and Guildenstern, to visit Hamlet and report back on his well-being. Hamlet, however, while genuinely distraught over his father’s death and the plea for vengeance from the ghost, is only feigning madness in order to deceive those around him and better enable him to determine the true cause of that death.
It is in this context that the quote in question is made by Hamlet. Rosencrantz and Guildenstern, following the king and queen’s instructions, pay a visit to their friend to observe his behavior. Hamlet, however, correctly suspects their true intentions: to spy on him and report back to his uncle and mother. The following exchange reflects Hamlet’s wariness regarding this visit by Rosencrantz and Guildenstern and the suspicions surrounding his acceptance of his visitors:
Hamlet: “What a piece of work is a man! how noble in reason! how infinite in faculty! in form and moving how express and admirable! in action how like an angel! in apprehension how like a god! the beauty of the world! the paragon of animals! And yet, to me, what is this quintessence of dust? man delights not me: no, nor woman neither, though by your smiling you seem to say so.
Rosencratz: My lord, there was no such stuff in my thoughts.
Hamlet: Why did you laugh then, when I said 'man delights not me'?”
Hamlet knows why his friends have arrived, and indicates by his comments that the deception has failed and that he is cognizant of the reason for this encounter.
This monologue is very sarcastic in nature. Hamlet mocks how people think so highly of themselves. He parrots some of the praises that people give themselves, and at the end, he states that he believes that mankind is a "quintessence of dust" and does not delight him. At this point in the play, Hamlet believes that people are immoral creatures. He has seen that the life of his father was dismissed almost immediately. Everyone but him moved on, and his mother even remarried immediately. He then learns that his father was murdered. When Hamlet sees that his friends can be turned into spies against him, he has little faith in humanity left. Because he is so critical of humanity, he gives this mocking speech.