In Shakespeare's Hamlet, before Claudius kills Hamlet's father and the ghost appears to Hamlet, Ophelia and Hamlet were happily in love, although as far as we can tell from the events of the play, there are odd ambiguities in the relationship, possibly due to Ophelia having a passive character and Hamlet an indecisive one. Although they seem to love one another on one level, they do not confide in each other and both are involved in plots that involve deceiving one another. In Act I Scene III (lines 585 sq.), for example, Ophelia vacillates between belief in Hamlet's love and agreeing with her father's doubts.
When Hamlet decides to feign madness as part of his plot to entrap Claudius, he vehemently rejects Ophelia, who herself is knowingly letting the conversation happen in front of spies. Shortly after this, Hamlet murders Ophelia's father Polonius. Ophelia is not a mentally strong character to begin with; when she is rejected by Hamlet, orphaned, and neglected by her brother, her reason is overset.
Hamlet's feigned madness enters into this because his rejection of Ophelia is part of his attempt to convince people he is mad.
Ophelia is one of the lesser characters in the play who is in the court of Elsinore because of her father being the king's counselor. She serves as a female interest of Hamlet's. As a love interest, we are given conflicting images of the relationship. We are told of "hot love on the wing". Even at the end of the play at Ophelia's grave, Gertrude laments that Ophelia would have been Hamlet's bride. What we actually see in the play though is completely different. The two do not actually meet until 3.1 right after the "to be" speech. When they meet on stage Hamlet greets her as he would a stranger; very formal. Compare the Captain in 4.4, when Hamlet says, "I humbly thank you sir." and to Osric in 5.2, "I humbly thank you sir." to Ophelia in 3.1 , "I humbly thank you, well." That's as civil as it gets between the two. This dichotomy is an important thematic element in the play.
Ophelia also serves, within the context of the garden metaphor, as a flower of Denmark whose stewards in the play are primarily Polonius and Laertes. Her mind is supplied by them. When we first hear from her she is with her brother Laertes and he is lecturing her. Her first words are a question, "Do you doubt that?" Her second, a statement that just agrees with Laertes. Only at the end of this duet does she become declarative, but then she merely parrots back to Laertes what he has told her.
After Polonius appears and takes over the discussion from Laertes, Polonius asks her directly about what she thinks of Hamlet's advances. She has no answer: "I do not know my Lord what I should think." She can only describe Hamlet's approach as "honorable" and "holy". Then in "The Mousetrap" she admits to Hamlet, "I think nothing my lord." Of the 60 uses of the word "think" in the play, Ophelia uses the word as a positive expression of her own mind just once. That is in 4.5 when thinking of her father being laid "i'th' cold ground." After her father's death she becomes "divided from herself and her fair judgment." But, at this point, all she can do is recite pieces of poetry and songs.
Her end comes at the moment, her brother's mind is turned to the dark side and taken over by Claudius. Having lost all care from her men in the play she dies from over-watering. Laertes:"Too much of water hast thou poor Ophelia,". In part she signals the sickness and decline in Denmark under the ruling family.