How did the first marathon come to be?

The marathon originated in an ancient town in Greece known as Marathon.