Final answer:
Hamlet's directive to Ophelia to get to a nunnery and labeling everyone as sinners reveals his deeply pessimistic view of people and especially women, rooted in his feelings of betrayal and moral decay. His harshness serves as a protection for Ophelia from the corrupt court and also as an expression of his own emotional turmoil.
Step-by-step explanation:
When Hamlet tells Ophelia, “Get thee to a nunnery: why wouldst thou be a breeder of sinners...We are arrant knaves all; believe none of us,” he is expressing his personal dark views on the human condition. His statement reflects a profound disillusionment with both the institution of marriage and the moral frailty of human beings.
He perceives the world as corrupt and views women, like his mother, through a lens of betrayal and disappointment. In the broader context of the play, Hamlet's behavior towards Ophelia can be seen as intentionally cruel, as he aims to push her away and thus protect her from the corrupted court of Denmark.
On another level, Hamlet's harshness could be a demonstration of his internal turmoil and moral disgust, which is “occasioned by his mother,” but exceeds her as an adequate source to express his feelings. This emotional excess, which he cannot objectify or understand fully, leads to his cruel treatment of Ophelia as an outlet for his frustration and anger.