He will be...
Shortly after he first sees the ghost, Hamlet tells Horatio he will pretend to be mad (crazy). He calls this seeming madness "an antic disposition":
How strange or odd some'er I bear myself
(As I perchance hereafter shall think meet
To put an antic disposition on)
He will be doing this to confuse the people around him as he investigates and determines what to do about the ghost's revelation. He also knows the shocking news will affect him emotionally, and people will notice this, so he wants them to have an explanation for his behavior. This is an instance of dramatic irony, in which the audience knows what most of the characters in the play do not.
I am but mad north-north-west: when the wind is
southerly, I know a hawk from a handsaw.
Hamlet says this to "play" or deceive to fawning courtiers Rosencrantz and Guildenstern, but as Claudius will later note, there's a method to Hamlet's madness. Hamlet is telling these men he is only mad sometimes: when the wind comes from the right direction (he is around people he trusts), he knows what is going on.
What makes the play interesting, however, is the questions it raises about whether Hamlet really does have fits of madness caused by the intense stress of what he knows and his inner turmoil over what to do about it. At the moment he confronts Gertrude in her chamber, has he finally been pushed over the edge into mental breakdown? Gertrude seems to think so as she watches him address what to her is empty air. He looks crazy to her with his wild eyes and his hair standing on end. She speaks of his madness as a "distemper." We as an audience have to wonder if Hamlet is really seeing the ghost or suffering a hallucination, because in its earlier incarnations, other could see the ghost, too. She says to Hamlet,
Alas, how is't with you,
That you do bend your eye on vacancy
And with the incorporal air do hold discourse?
Forth at your eyes your spirits wildly peep,
And, as the sleeping soldiers in the alarm,
Your bedded hair...
Starts up, and stands on end. O gentle son,
Upon the heat and flame of thy distemper
Sprinkle cool patience!
In the quote below, Gertrude, explaining to Claudius how Hamlet murdered Polonius, says he is mad in a way that suggests she understands he is being ripped apart by his inner conflict. She uses a simile as she likens him to a furious wind and sea doing battle:
Mad as the sea and wind when both contend
Which is the mightier.