Even though Hamlet loves Ophelia, why does he seem to contradict his emotions towards her in Shakespeare's Hamlet?
Knowledgeable of subterfuge against him on the part of Claudius and Polonius who exploits his daughter Ophelia to his ends, Hamlet acts contrary to how he feels towards Ophelia in Act III, Scene 1. In this scene, he is needlessly cruel to her because of his distrust and suspicion of Polonius. When, for instance, Ophelia tries to return to Hamlet mementos of the prince, Hamlet denies these things,
I never gave you aught.(3.1.104-105)
Further, the prince urges her to put herself into a convent away from men since his own faith in men has failed,
We are arrant knaves
all; believe none of us. (3.1.137-138)
While Hamlet's urging of Ophelia's going to a nunnery and secluding herself from the world seems a rejection, in a way Hamlet tries to warn her and shield her from the ploys of her father and Claudius by his feigned madness and rejection of her. This madness he continues in the next scene as he makes bawdy comments to Ophelia before the play in his attempts to fool Gertrude and Claudius into thinking that he is not in control of his senses so that they may let down their guard and reveal things to him.
That he certainly loves her is evinced later in Act V when Hamlet declares,
I loved Ophelia. Forty thousand brothers
Could not, with all their quantity of love,
Make up my sum. (5.1.270-272)
Tragically, Hamlet has not meant for Ophelia to have become so devastated by his temporary rejection of her.