The entire scene leading up to Hamlet's conversation with the ghost is important because it reveals much of Hamlet's character. Horatio first informs Hamlet of the ghost's visits. After Hamlet questions Horatio at length about the visual appearance of the ghost, Hamlet is fairly convinced that the ghost is indeed his father, who has returned to tell him something important.
The problem, however, is that both Hamlet and Horatio know that ghosts are sometimes the devil in the disguise of a loved one. Such a ghost returns only to cause harm. Horatio, less emotionally involved than Hamlet, is very concerned about this possibility.
When they both first see the ghost, Hamlet immediately talks to it, which shows Hamlet's determination. Before he speaks to the ghost, he whispers a sort of prayer: "Angels and ministers of grace defend us." He says this as a measure of protection in case the ghost intends to harm them. This "prayer" reveals Hamlet's religious faith. He then demands that the ghost explain why the
sepulchre / Wherein we saw thee quietly inurn'd, / Hath oped his ponderous and marble jaws, / To cast thee up again.
He uses a very comanding tone and asks many questions of the ghost, showing that he is suspicious and trying to keep control of the situation.
When the ghost refuses to speak but motions for Hamlet to follow him to a more private place, Horatio is very concerned, but Hamlet responds with
Why, what should be the fear? / I do not get my life at a pin's fee; and for my soul, what can it do to that / Being a thing immortal as itself?
Here Hamlet is revealing his lack of concern for his physical safety, something that he has expressed earlier in the play. He doesn't think his life is worth "a pin," so he isn't as worried as he perhaps should be. This reveals a sense of fatalism.
When Horatio and the others try to physically restrain Hamlet from going after the ghost, he yells at them and declares
Unhand me, gentlemen. / By heaven, I'll make a ghost of him that lets me. / I say, away!
Hamlet is absolutely determined to go with the ghost at all costs. He threatens any person who would try to stop him. This is a brash young prince who will do what he needs to do to accomplish his goal, which will later prove ironic. This early representation of Hamlet is at odds with the indecisive Hamlet presented later in the play.