Dead - devoid of life (when applied to people, plants or animals). Finished with - unusable (when applied to inanimate objects).
This is old - at least 14th century. There's a reference to it in print in 1350:
"For but ich haue bote of mi bale I am ded as dorenail."
Shakespeare used it in King Henry VI, 1590:
Brave thee! ay, by the best blood that ever wasbroached, and beard thee too. Look on me well: Ihave eat no meat these five days; yet, come thou andthy five men, and if I do not leave you all as deadas a doornail, I pray God I may never eat grass more.
As 'X' as 'Y' similes refer to some property and then give an example of something well-known as exhibiting that property, e.g. 'as white as snow'. Why door-nails are cited as a particular example of deadness isn't clear. Door-nails are the large-headed studs that were used in earlier times for strength and more recently as decoration. The practice was to hammer the nail through and then bend over the protruding end to secure it. This process, similar to riveting, was called clenching. This may be the source of the 'deadness', as such a nail would be unusable afterwards.