A story that has been told repeatedly before, a 'venerable' joke. Hence, in extended use, anything trite, stale, or too often repeated.
The phrase 'old chestnut' has only an indirect association with chestnut trees or with their fruit. The derivation of the expression turns out to be a contender for old chestnut status itself. The story goes like this: in 1816, a melodrama called Broken Sword, by the playwright and theatrical manager William Dimond, was performed at the Royal Covent Garden Theatre, London. The play contained this exchange:
Zavior: I entered the wood at Collares, when suddenly from the thick boughs of a cork tree...
Pablo: (Jumping up.) A chesnut, Captain, a chesnut... Captain, this is the twenty-seventh time I have heard you relate this story, and you invariably said, a chesnut, till now.
Despite a drubbing from the critics, the play was a success and later transferred to theatres in the USA. So far, so factual.
Here's where we move from fact to plausibility. In the 1880s, many American newspapers began using 'chestnut' in the way we do now, to refer to hoary, oft-repeated stories, and the term became established in the common lingo thereafter. The 'old' was added later as an intensifier.
In April 1896, the Ohio newspaper The Daily Herald took it unto itself to explain the phrase's origin. It published a story about the actor who had played Pablo in early productions of Broken Sword:
William Warren, who had often played the part of Pablo, was at a 'stag' dinner when one of the gentlemen present told a story of doubtful age and originality. 'A chestnut,' murmured Mr. Warren, quoting from the play. 'I have heard you tell the tale these 27 times.' The application of the line pleased the rest of the table, and when the party broke up each helped to spread the story and Mr. Warren’s commentary.
The play itself, although popular in its time, was 80 years old by 1896 and Warren was long dead, so the Daily Herald story was (at best) based on Chinese whispers or (at worst) pure invention. However, even if that stag dinner wasn't the first use of the 'chesnut' expression and Warren didn't originate it, someone else could easily have used the same source. The gist of the tale, that 'old chestnut' derives from the play Broken Sword, hovers somewhere between plausibility and fact and many choose to believe it.