Is Ophelia connected in any way with the crime Hamlet seeks to avenge? Why is he so brutal to Ophelia in Act III, Scene 1? Why does she go mad?
No, Ophelia is not connected with the crime Hamlet seeks to avenge--at least not directly or intentionally. Ophelia's crime is her naiveté.
Because she is concerned over Hamlet's odd behavior, and because she hopes that Polonius is correct in presuming that this odd behavior is due to Hamlet's love for her, and because she is an obedient daughter, Ophelia allows herself to be used. She agrees to cooperate in a scheme to spy on Hamlet, hoping that what Polonius and Claudius witness will lead to Hamlet's and her reunion. She hopes that the plan will prove Hamlet's love for her, and that their parents will then allow them to be together.
Unfortunately for Ophelia, the plan backfires. The Kenneth Branaugh rendition of Hamlet shows that during their conversation, Hamlet hears a noise (made by the spying Polonius), and it is at this point he asks Ophelia the all-important question, "Where is your father?"
What Ophelia does not know or even suspect is that Old Hamlet was murdered. She has no reason to think that Claudius is hiding anything and no idea that Hamlet distrusts Claudius or her father. So when she answers that her father is "at home" in order to carry on with the plan to prove Hamlet is in love with her, she is amazed at Hamlet's reaction.
Hamlet flies into a rage. He feels completely betrayed by Ophelia’s complicity with her father and Claudius. He is so blinded by his need for revenge that he doesn't consider any other reason for her to lie to him than that she is working with his enemies. From this point on in the play, Hamlet berates Ophelia and makes lewd remarks to her.
When Hamlet mistakenly kills Polonius later in Act III, Ophelia goes mad. Her madness is a result of a combination of factors:
1. She loves Hamlet and is not only shunned by him, but treated horribly by him.
2. Her father, whom she also loves, is dead.
3. Her father has been murdered by the man she wants to marry.
4. She is alone in the world now that Leartes is away, her father is dead, and Hamlet has completely rejected her.
5. She may be pregnant. (This possibility is indicated in Act IV Scene 6 when she sings about a maid losing her virginity and later in the same scene when she gives herself rue--which could be used to cause a miscarriage.)
Check out Enotes page on Hamlet for more information.
There is an interesting web site that analyzes the meanings behind the different flowers Ophelia presents to people during her second mad scene (Act IV Scene 6). I have added a link to that page below.
So, although Ophelia was not in any way connected to the murder of Old Hamlet, Hamlet counts her among his enemies since she cooperates with his enemies in a plan to spy on him. He does judge her too harshly, and later regrets his actions. He finally admits he loved her at her funeral when it is all too late.
The answer submitted by rowens to your question is thorough, though my secret doubt is that Shakespeare was more concerned with theatrical effect than consistent motive.
Ophelia is not a strong character. She acquiesces to everyone; her brother, her father, and to Hamlet. But the inner workings of her mind are unexplained. The fact is that we don't know why Ophelia goes mad; we can only speculate. But madness was a common element in the revenge tragedy, and Shakespeare's audience would have expected somebody to go truly mad at some point. Just as a ghost would have been a necessary ingredient to the story.
Hamlet's rage at Ophelia is more easily explained. Many performance have staged the scene that Hamlet becomes incensed because he realizes that somebody is eavesdropping, and it's obvious that Ophelia knows. On the other hand, Hamlet's reaction seems a little extreme. Perhaps he's not as sane as he says!