There are a number of options you have in explaining Hamlet's behaviour towards Ophelia in Act III scene 1, the famous nunnery scene, where Hamlet is rather cruel towards her. One of my favourite adaptions of this play is the Kenneth Brannagh version, which suggests the reason why Hamlet is so cruel towards Ophelia is that he becomes aware that their conversation is being watched by Polonius and Claudius. This of course represents a betrayal of Ophelia towards him, and in this version Hamlet is grief-stricken by yet another betrayal of somebody whom he loves. Yet if we think about it, how a director stages this scene is necessarily going to revolve around a question that the text does not answer for us: is Hamlet aware of Claudius and Polonius and at what point does he become aware of them?
The way a director answers this question will of course have massive ramifications in terms of Hamlet and how his character is played in this scene. If he remains ignorant of their presence, then this scene strongly suggests Hamlet's madness and the way that he is losing control of himself. If he is aware of their presence, this could be a scene where he uses Ophelia, just as Ophelia has used him, to continue to present his "antic disposition" to the King. Being aware of the presence of Polonius and Claudius also gives another further option: Hamlet is so cruel to Ophelia because she has been so cruel to him in betraying him and setting him up.