After Polonius has instructed Reynaldo on how he should spy on his son, Laertes, Ophelia comes rushing in to see him in Act II scene 1. She is clearly distraught and rather upset about what she has just seen, and as she tells her father (and the audience), Hamlet is the source of her discomfort. Note what she says about what he did:
My lord, as I was sewing in my chamber,
Lord Hamlet, with his doublet all unbraced,
No hat upon his head, his stockings fouled,
Ungartered, and down-gyved to his ankle,
Pale as his shirt, his knees knocking each other,
And with a look so piteous in purport
As if he had been loosed out of hell
To speak of horrors, he comes before me.
Hamlet therefore, dressed in a very bizarre fashion and looking very unkempt came before Ophelia as if he were mad and had seen something so terrifying that it is as if he had seen a glimpse of hell. Ophelia, understandably, is terrified, and rushes to tell her father. Of course, Shakespeare is very carefully juxtaposing this scene with Act I scene 5, which is when Hamlet revealed to the audience and to Horatio and Marcellus that he was going to feign madness. This appearance before Ophelia can therefore be interpreted as his opening sally in this stratagem.