1560s, from chesten nut (1510s), with superfluous nut (n.) + Middle English chasteine, from Old French chastain (12c., Modern French châtaigne), from Latin castanea "chestnut, chestnut tree," from Greek kastaneia, which the Greeks thought meant either "nut from Castanea" in Pontus, or "nut from Castana" in Thessaly, but probably both places are named for the trees, not the other way around, and the word is borrowed from a language of Asia Minor (cf. Armenian kask "chestnut," kaskeni "chestnut tree"). In reference to the dark reddish-brown color, 1650s. Applied to the horse-chestnut by 1832.
Slang sense of "venerable joke or story" is from 1885, explained 1888 by Joseph Jefferson (see "Lippincott's Monthly Magazine," January 1888) as probably abstracted from the 1816 melodrama "The Broken Sword" by William Dimond where an oft-repeated story involving a chestnut tree figures in an exchange between the characters "Captain Zavior" and "Pablo":
Zav. Let me see--ay! it is exactly six years since that peace being restored to Spain, and my ship paid off, my kind brother offered me a snug hammock in the dwelling of my forefathers. I mounted a mule at Barcelona and trotted away for my native mountains. At the dawn of the fourth day's journey, I entered the wood of Collares, when, suddenly, from the thick boughs of a cork-tree--Jefferson traced the connection through William Warren, "the veteran comedian of Boston" who often played Pablo in the melodrama.
Pab. [Jumping up.] A chesnut, Captain, a chesnut!
Zav. Bah, you booby! I say, a cork!
Pab. And I swear, a chesnut. Captain, this is the twenty-seventh time 1 have heard you relate this story, and you invariably said, a chesnut, till now.
A trite old story, joke, song, etc
[1816+; probably fr a play, The Broken Sword, in which one character tells a story 27 times, naming a chestnut tree, then abruptly changes it to a cork tree, whereupon another character recalls the repetition of chestnut, and the first says, ''Well, a chestnut be it then'']