According to legend, James the Greater (as opposed to James the brother of Christ) came to Spain to preach the Gospel, but was completely unsuccessful. He returned to Jerusalem and was martyred and denied burial by Herod. James' followers put his body into a boat which sailed, of its own accord, to Cape Finisterra (the end of the world), back in Spain. The body was interred on a nearby hill and promptly forgotten.
Fast forward to the 9th century, when a shepherd follows a falling star to rediscover the tomb of St. James. Charlemagne gets wind of it and ramps up the publicity and before you know it pilgrims are hiking across Europe to pray at the tomb.
In time the tomb of Santiago became the third greatest pilgrimage destination in Christiandom, after Jerusalem and Rome. Bridges were built and towns sprang up along the pilgrim road. By the 17th century, however, the pilgrims faded away.
But in the late 20th century, modern pilgrims arose, retracing the ancient route. The church set up pilgrims' hostels. Trails were built, signs were posted, bridges were repaired. And now thousands of pilgrims go streaming across northern Spain, walking and biking to Santiago.