.
Hamlet is a very angry character in the play. He is angry with his uncle, his mother, and himself. This anger makes it easier for him to act crazy, and more willing to do crazy things without thinking first. That is one of the reasons why people assume he is insane. They do not take into account that the anger and rage inside him compliment his temptation to act crazy. Hamlet plays everyone for a fool. Yes, there are times when he questions his sanity, like when he is alone, but he only does that because he has grown into his act of trickery and thinks he might be taking this play-madness too far. But he soon comes back to the reality that this is only to help him proceed into what he plans to do in the future. He fakes his insanity because it allows him to do several things that he otherwise would be unable to do. .
In the beginning of the play he confides to Marcellus & Horatio that he is going to pretend to be insane, and then he proceeds to do so. His conversations with Horatio and the audience are well-reasoned and absolutely not mad chatters. He may be neurotic and he may question his own sanity, but neither of these factors make him crazy.
When it comes to Ophelia, Hamlet does truly love her. His feelings for her are genuine. After having her treat him badly and the fact that his mother is married to his uncle, he comes to hate women. This does not mean his love for Ophelia has faded away. He is mad about the subject of the women in his life in the sense that he is angry, not insane. The two people in which he confides, Ophelia and Gertude, the two people he thought he could trust and go to in times of pain and anguish have wronged him in a way and hurt his feelings. With respect to Ophelia, he would like to express his intense and strong anger towards her without raising suspicion in her or in others that he is in a crazy and senile state of mind. By doing that it prevents others in the royal family from thinking that Hamlet was planning actions of vengeance against his uncle, presently King of Denmark.