Hamlet hatches the actual plan to fake madness in Act I scene 5 after his conversation with the Ghost. As he swears Marcellus and Horatio to a vow of secrecy he tells them that he is planning to feign madness in the near future:
As I perchance hereafter shall think meet
To put an antic disposition on...
It is this "antic disposition" that leads to the huge dilemma surrounding Hamlet's character, which is whether he is actually mad or not. We find out about his first appearance in his disguise (or otherwise) of being mad in Act II scene 1, when Ophelia relates to her father how he appeared in her bedchamber. He didn't actually "say" anything on this occasion, but his actions clearly indicate his supposed madness:
He took me by the wrist, and held me hard;
Then goes he to the length of his arm;
And with his other hand thus o'er his brow,
He falls to such persual of my face
As he would draw it. Long stay'd he so;
At last, a little shaking of mine arm:
And thrice his head thus waving up and down;
He rais'd a sigh, so piteous and profound,
As it did seem to shatter all his bulk,
And end his being.
Quite clearly, although he utters nothing except a deep sigh, Hamlet does a very convincing job of passing himself off as mad to Ophelia, as the rather concerned and frightened way she relates this experience to her father indicates.