You’re likely most familiar with New York City’s “Gotham” nickname from Batman comics and movies, but the nickname actually predates the Dark Knight by nearly 120 years.

Though we tend to think of “Gotham” as a dark, brooding city constantly on the brink of destruction, the term dates back to medieval England. It means “Goat’s Town”  in Anglo-Saxon—which couldn’t be further from how we think of New York City today. It’s also the name of an actual town in England, a sleepy little village in Nottinghamshire. So how did the misnomer come to be?

Author and NYC native Washington Irving started using the term in 1807 in his satirical periodical, Salmagundi. It’s believed that he was inspired by a folk tale called “The Wise Men of Gotham.” In it, residents of England’s Gotham village catch wind that King John will be traveling through their town. Knowing that the king’s visit would bring chaos and turn their quiet village into a circus, the citizens of Gotham decided to feign madness—believed to be contagious at the time—to encourage the king to find another path. They put their plan into action by performing crazy stunts, including trying to drown an eel in a pond and building a fence around a bush to prevent a cuckoo from escaping. The shenanigans worked in this story—King John bypassed Gotham in favor of a town with more sense.

By repeatedly using “Gotham” in a publication created to lampoon New York culture, Irving was poking a little fun at the city and its residents by comparing it to a village where people pretended to be crazy. New Yorkers embraced the moniker, either not aware that Irving was mocking them, or out of pride for being considered craftily crazy.