Before the ghost beckons Hamlet, he is, of course, overwhelmed and full of questions. He tells the ghost that since he (ghost) has the appearance of his father ("a questionable shape"), he will speak to it no matter what.
Horatio and Marcellus warn Hamlet not to follow the ghost. Hamlet wants to hear the ghost speak; he is determined to hear it speak. In addition to this determination, he's also in a bold state of mind. Still grieving for his father and distraught by his mother's hasty marriage to Claudius, he feels like he has nothing to lose by following the ghost:
Why, what should be the fear?
I do not set my life at a pin's fee;
And for my soul, what can it do to that,
Being a thing immortal as itself?
It waves me forth again. I'll follow it. (I.iv.70-74)
Despite further warnings from Horatio and Marcellus, Hamlet is determined to follow the ghost, claiming it is fate (end of Act 1, Scene 4).
Here is a theatrical version of the scene you are referencing: