Because he knows her purpose in talking to him.
At that time, Hamlet believed that Ophelia was sharing his private love letters to Her father (hamlet regarded the letters as extremely personal).
Combined with his emotional trauma from his mother's action, Hamlet became overreacted in handling this matter.