Hamlet's behavior is likely part of his plan to "put an antic disposition on." He knows that by acting crazy around someone who knows him well, he will be able to establish his "act." In her report of his behavior she explains that everything about Hamlet's behavior was completely different from his normal self. First of all, he never actually spoke a word, but instead just looked at her in a kind odd, intense way. He holds her hard and shakes her a little bit. He walked out of the room forward, but with his head turned back to continue his staring at her. All very odd indeed. She is shocked even by his physical appearance. She Polonius all about his manner of dress:
Lord Hamlet, with his doublet all unbraced,
No hat upon his head, his stockings fouled,
Ungart'red, and down-gyved to his ankle;
Pale as his shirt, his knees knocking each other,
And with a look so piteous in purport
The minute he leaves, she runs to tell her father all of this. Hamlet's plan is a success if he is doing this to try to convince the court he is a bit crazy and therefore Claudius may let down his guard so that Hamlet could perhaps discover the truth about Hamlet. It even serves his purpose if Polonius concludes that Hamlet is crazy because of the rejected love of Ophelia. At least then Claudius won't suspect that Hamlet is on to him.
Ophelia tells Polonius that in her most recent meeting with Hamlet, Hamlet was disheveled, erratic and “held her hard.” Hamlet is acting out his frustration on Ophelia as representing all women because Hamlet is so disgusted with his mother’s ‘quick marriage’ to Claudius. Polonius tells her “this is the very ecstasy of love.” He means that Hamlet is just lovesick (for Ophelia) and upset that she has avoided him (per Laertes’ request). In Act I, Polonius had believed that Ophelia had meant to trifle with Ophelia, but now he believes Hamlet’s erratic behavior is the result of a mixture of his grief over his father and his passion for Ophelia.