early 14c., "chest or box for valuables," from Old French cofin "sarcophagus," earlier "basket, coffer" (12c., Modern French coffin), from Latin cophinus "basket, hamper" (source of Italian cofano, Spanish cuebano "basket"), from Greek kophinos "a basket," which is of uncertain origin.
Funereal sense "chest or box in which the dead human body is placed for burial" is from 1520s; before that the main secondary sense in English was "pie crust, a mold or casing of pastry for a pie" (late 14c.). Meaning "vehicle regarded as unsafe" is from 1830s. Coffin nail "cigarette" is slang from 1880; nail in (one's) coffin "thing that hastens or contributes to one's death" is by 1792.