an old chestnut is a stale joke
Eric Partirdge in Origins (1983 edition) says the probable origin is eating roasted chestnuts at the fireside while listening to old stories.
Brewer's Dictionary of Phrase and Fable traces the origin to The Broken Sword, a forgotten melodrama by William Dimond (1816) in which one of the characters, Captain Xavier, is forever telling the same jokes, over and over, with slight variations. As he repeats a certain joke involving a tree, this time making it about a cork tree, Xavier is corrected by Pablo, who says, "A chestnut. I have heard you tell the joke twenty-seven times, and I am sure it was a chestnut."