1670s, "secret or private stories," from French anecdote (17c.) or directly from Medieval Latin anecdota, from Greek anekdota "things unpublished," neuter plural of anekdotos, from an- "not" (see an- (1)) + ekdotos "published," from ek- "out" (see ex-) + didonai "to give" (from PIE root *do- "to give").
Procopius' 6c. Anecdota, unpublished memoirs of Emperor Justinian full of court gossip, gave the word a sense of "revelation of secrets," which decayed in English to "brief, amusing story" (1761).