The play doesn't actually make it quite clear what Horatio's motives are. But he sees it, just like a historical Roman, as more noble to commit suicide. When Hamlet says
Horatio, I am dead;
Thou livest; report me and my cause aright
To the unsatisfied.
Horatio disagrees -
Never believe it.
I am more an antique Romanthan a Dane.
Here's yet some liquor left.
As th'art a man,
Give me the cup. Let go! By heaven, I'll have't.
O God, Horatio, what a wounded name,
Things standing thus unknown, shall live behind me!
If thou didst ever hold me in thy heart,
Absent thee from felicity awhile,
And in this harsh world draw thy breath in pain,
To tell my story.
In short, Hamlet wants Horatio to be around to tell the story of why Hamlet did what he did, and exactly what happened. There needs to be a witness for history to judge him kindly. And what Hamlet doesn't realise within the play, but Shakespeare realises without it, is that history, is of course his story. The play - Hamlet - does exactly what Hamlet asks Horatio to do.