Unlike PCs in games, literary characters have special feature called- Plot Armor. It's hard to make series and sell sequel books if you kill of protagonists ( there are some exceptions, like ASOIF, but i would argue that there aren't any protagonists in it in classical sense).
Also, in fiction, author has complete control of what happens to main characters. In games, there is always element of luck. You roll very bad, DM rolls exceptionally well, things happen ( seen it happen, whole party never rolled higher than 10 in couple of rounds, DM rolled 3 crits in a row, 3/4 PC-s are down in 2 rounds). While protagonist dead from random encounter 3 chapters into the story makes not so good story to read, in games, that happens, 2 sessions in, string of bad rolls, tpk or near tpk happens.