The marathon is named after a battle, but the race itself is a modern invention built on a legend that the oldest source does not tell.

Marathon was a town on a plain in Attica, northeast of Athens. In 490 BC the Athenians defeated a Persian army there. The place name probably comes from the Greek word for fennel, which seems to have grown wild on the plain. The British Museum states this plainly. Etymonline gives "fennel field" but calls the etymology uncertain.

The running story is where things get tangled. Herodotus, the earliest source, tells of a messenger named Pheidippides. He ran from Athens to Sparta to ask for help before the battle, covering about 240 kilometres in two days. He did not run from Marathon to Athens.

That shorter, more dramatic run appears centuries later. Plutarch credits it to a herald named Thersippus or Eukles. Lucian, a century after Plutarch, calls the runner Philippides. In 1879 Robert Browning's poem "Pheidippides" merged the two stories into one.

The poem inspired the French scholar Michel Bréal. He wanted a long road race in the first modern Olympic Games, held in Athens in 1896. That is when marathon entered English as the name of a race. The early Olympic marathons ran about 40 kilometres, roughly the distance from Marathon to Athens.

The odd official distance came later. For the 1908 London Olympics, the course started on the East Lawn at Windsor Castle and finished in front of the Royal Box in the stadium. It measured 26 miles and 385 yards. Wikipedia says the IAAF adopted that length as standard in 1921, though its minutes do not say why.

The word soon broke loose from running. Etymonline records a "marathon dance" by 1910, meaning any long endurance contest. The ending was then cut off and reused as a suffix. That gave English walkathon (1931), telethon (1949) and swimathon (1968). None of them has anything to do with fennel or Persians, but every one of them borrows the battlefield's name.