In Paulo Coelho's The Alchemist, the King of Salem, also known as Melchizedek, is the individual in the story who actually starts Santiago on the correct path to realize his Personal Legend.
When Santiago meets the King of Salem, the old man at first irritates the boy. Soon Santiago realizes that Melchizedek knows things about him that he shouldn't—they are strangers.
...the boy was able to read what the old man had written in the sand.
There, in the sand of the plaza of that small city, the boy read the names of his father and his mother and the name of the seminary he had attended...
Then the King of Salem introduces the topic of one's Personal Legend, something the boy has never heard of. Melchizedek explains:
It's what you have always wanted to accomplish. Everyone, when they are young, knows what their Personal Legend is.
At that point in their lives, everything is clear and everything is possible...
The king also explains that a mysterious force tries to stop people from realizing their Personal Legend, but that it is actually a force that "prepares your spirit and your will..."
And then, Melchizedek says...
And, when you want something, all the universe conspires in helping you to achieve it.
The King of Salem comes to Santiago because he realizes that Santiago is ready to give up searching for his Personal Legend. In fact, Melchizedek notes that he always appears in one way or another, as a "solution, or a good idea," to keep people going so they don't stop when they have come so close to realizing their Personal Legend.
When Santiago finally sells his sheep, the old man tells the boy about omens and how important they are, echoing words his grandfather had once told him. The old man also give Santiago two stones: Urim and Thummim, to help him make important decisions.
In essence, the King of Salem introduces Santiago to the most important concept: that of the Personal Legend and its oneness with all things. The king advises him to watch for omens, which will keep him on the correct path. And he gives Santiago knowledge and encouragement to carry with him to guide him along the way. Had it not been for the King of Salem, Santiago would never have realized his Personal Legend, which leads him to great happiness.