Jim cries at the captain's death because it is the second death he has ever known. He is still a child unaccustomed to mortality and danger, so having experienced two deaths in such a short period of time proves emotionally overwhelming for him.
Right before Billy Bones (whom Jim refers to as "Captain") dies, Jim Hawkins has just been returning from his father's funeral. While the death of Jim's father is often cut from most film versions of the story, in the book, it is part of what severs Jim from the familiar, comforting world of his childhood. The loss of his father also marks the first time Jim experiences death.
Unlike the death of Jim's father, who was an ordinary but morally acceptable man, Billy's death is more dramatic and sordid. He has already been drinking himself into ill health, and the attack that kills him comes from the terror of being tracked down by Blind Pew and given the dreaded Black Spot. He dies shortly after. The reader does not see much of Jim's reaction to his father's death, but from the lines during Billy's death, it is clear that he is being affected deeply, since he has lived such an insulated life up until that point:
I ran to him at once, calling to my mother. But haste was all in vain. The captain had been struck dead by thundering apoplexy. It is a curious thing to understand, for I had certainly never liked the man, though of late I had begun to pity him, but as soon as I saw that he was dead, I burst into a flood of tears. It was the second death I had known, and the sorrow of the first was still fresh in my heart.
It must be remembered that Jim is still a boy. His calling for his mother as Billy suffers and his weeping at discovering Billy dead are meant to show how very young he still is, emphasizing the coming-of-age element of the story. Death becomes one way in which Jim is pushed out of childhood and into the uncertain world of adults.