Like with many things in Christianity I think this legend was invented in order to incorporate the traditions of other religions. This helped those who were not Christian relate to the religion and possibly convert.