Minecraft wiki entry for Death_messages, associated text: <player> died
Is coded to appear only when the player achieves a death that is not assigned to a damage type (magic, cactus etc.) or is assigned to the generic damage type. Currently replicable in 1.17.1+ by naming a bee with a name tag, letting it sting a player, waiting for it to die and looking at the game's log.
<player> died because of <player/mob>
Is coded to appear only when the player is hurt by a player or mob then achieves a death that is not assigned to a damage type or is assigned to the generic damage type. Currently replicable in 1.17.1+ by naming a bee with a name tag, letting it sting a player, punching it while waiting for it to die naturally and looking at the game's log.