I used to be told that the reason James Cook was killed by the Hawaiians was because they mistook him for Lono and then when he returned on a day they didn't respect, they said "Hey this guy isn't a god at all, let's kill him."
Apparently that's not at all accurate. The idea is attributed to William Bligh and not supported by much evidence. It is true that when Cook's crew reached Hawaii the first time they arrived just at the New Year and the celebration of Lono, but Cook was never mistaken for a god.
More to the point -- I think the reason that the Hawaiians got mad at him for returning is because they felt like they had mistaken him for a nice person. They had struck up a friendship to begin with, things had been interesting, hey look at the new people -- and then the guy goes and swipes the wooden border from the Morai Mound? And then one of his captains accuses one of your chiefs of stealing a longboat, when the boat was never stolen? Forget it. Good riddance.
So when Cook came back to anchor in Kealakeuka Bay, the Hawaiians weren't interested in having him around anymore. And it was War Season anyway, so might as well have some fun. So they swiped a longboat from one of the ships to see how far Cook would go in retaliation. No wholesale slaughter yet, it's not like these guys are trying to kill us or any -- What do you mean he's kidnapping the Ali'i Nui.
Apparently Cook decided that if the locals were going to steal his damn longboat, he was going to steal their king so he could force them to sit down and shut up. That didn't go over well. The king sat down on the beach but that meant he wasn't going anywhere. And having thousands of angry locals glaring at you is usually a sign that things have not gone well. In the ensuing brawl, the king's personal attendant stabbed Cook with the steel dagger that Cook had traded for stuff on the last visit. Oh, the irony!
Cook's crew stayed in the bay another week to repair the mast and get some more fresh water. This only made things worse because the crew had to fight a number of skirmishes and use the cannon a few times, and a lot of Kireekakooa Town was burned. As for Cook's body -- William Bligh said he saw the Hawaiians tearing Cook's body to pieces but if he wasn't making shit up, he was probably failing to understand what they were actually doing. They were removing the organs as part of a proper kingly burial. Then they took his bones and cleaned them up and preserved them as religious icons. Eventually they gave some of his bones back to the crew.
The Hawaiians had held Cook in high esteem, and clearly they recognized his position on the ship as little different than that of the Ali'i Nui's position on the island. One king to another, after all, and no sense being cruel once the fighting is over, not when we used to be friends. Sometimes the two sides of a war can shake hands and forgive each other, long after the war is done.
What a pity that Bligh's description brought the Hawaiians into the trope of Weird Inscrutable Angry Savages, when their motives were perfectly human and easy to understand. Cook's death was a tragedy brought about by his own arrogance, the wrath of a people scorned and the passion of one loyal servant.