In Act 2, Scene 1, Polonius concludes Hamlet's erratic behavior stems from unrequited love for Ophelia—specifically, that she rejected him on Polonius's orders.
He tells Claudius and Gertrude: "This is the very ecstasy of love... / That hath made him mad." He's wrong—Hamlet's "antic disposition" is feigned—but the diagnosis drives Polonius's spying and the nunnery scene.