"Frailty, thy name is woman," so says Hamlet in his first scene (1.2.6). Hamlet's attitude toward women is notoriously sexist and stems from his disgust at his mother's sexuality and seeming unfaithfulness to his dead father. This outlook eventually spills over to include all women, especially the hapless Ophelia, who has virtually no power or control, even over her own body. To some extent, the play also considers notions of masculinity (or lack thereof). Claudius warns Hamlet that his grief is "unmanly" and Hamlet notoriously refers to himself as a promiscuous woman when he finds himself unable to avenge his father's death, which, again, circles back to Hamlet's association between women and deception. Yet, the play does not share Hamlet's furious dismissal of women. Hamlet's mother's final guilt is left ambiguous, and his lover ultimately inspires pity. Hamlet's attitude toward women reveals something about him more than it reveals women's true nature.
Hamlet is critical of women because he believes that their sexual "appetites" constantly lead them to betray men.
The play does not share Hamlet's sexist attitude. In fact, it paints a sympathetic picture of Ophelia and seems to suggest that her madness and tragic death are the result of unfair attitudes toward women.