Through clues that hint to earlier versions of the legend through out history. Legends are often scrambled and tiny parts of it change from person to person after a while. Since legends tend to come out of thin air a lot of the times, or come from distorted experiences or facts, its hard to pinpoint exactly how they started. But, historical linguists can trace versions of the legend where it has come up before and find the original or close to original way it was told, then they can determine by the words that were used to describe it and how it was described when the legend surfaced.