The phrase "dead men tell no tales," perhaps appropriately, has a mysterious origin. There are near-countless variations on the phrase (including my favorite, Ben Franklin's "Three men can keep a secret if two of them are dead"), which only complicates the matter. However, the earliest appearance of the "dead men can't tell your secrets" appears to be from the mystical Persian poet Sa'di, who lived in the 1520s CE and wrote of the best way to deal with tricksters (as I don't know Persian, here's an English translation):
"So I finished the rogue, notwithstanding his wails,
With stones, for dead men, as you know, tell no tales."
The phrase appears to have jumped into English via a clergyman named Thomas Becon, who lived in the later half of the sixteenth century. It got significantly more popular when Disney featured it in their "Pirates of the Caribbean" ride, but it's had a long history outside animatronic skulls.
"But why?" Lestrade demanded. "Why pull the trigger?"
John just shrugged. "Because the man kept his secrets in his head, and dead men tell no tales. He said he'd do anything, and he certainly kept his word."
The phrase is straightforward enough: if you're dead, you can't talk at all, much less share a secret. The best insurance is non-existence.
In contrast, never speak ill of the dead treats the recently departed with a bit more respect (I suppose, after you've already killed the man to keep your secret, the least you can do is not say bad things about them). It's something of a cousin to "If you can't say anything nice, don't say anything at all."
"Never speak ill of the dead," Molly said brightly. "Though it's not always easy to do here. Did you see what that man did to his lungs? They look like two big lumps of coal!"
This phrase is much older, with its written record dating back to the 4th century and the Greek writer Diogenes Laërtius, who attributed the phrase "Don’t badmouth a dead man" to Chilton of Sparta (who lived in the 600s BCE). It was then translated to the more respectable Latin De mortuis nil nisi bonum." (Of the dead, nothing unless good.)
For more on this one, TV Tropes has a nice round-up and notes that Christopher Hitchens pushed hard against this idea, amending it to "Never say anything nasty about the dead that you weren't brave enough to say while they were alive. Everything else is fair game."
Whenever a character has to go, their secrets often go with them. And not every character will want to respect their memory. However you use these phrases, now you know they have a respectable and interesting history.