While sleeping near a sycamore tree in the sacristy of an abandoned church, Santiago, a shepherd boy, has a recurring dream about a child who tells him that he will find a hidden treasure if he travels to the Egyptian pyramids. An old woman tells Santiago that this dream is prophetic and that he must follow its instructions. Santiago is uncertain, however, since he enjoys the life of a shepherd.
Next Santiago meets a mysterious old man who seems able to read his mind. This man introduces himself as Melchizedek, or the King of Salem. He tells Santiago about good and bad omens and says that it is the shepherd boy's duty to pursue his Personal Legend. Melchizedek then gives Santiago two stones, Urim and Thummim, with which to interpret omens.
Santiago wavers briefly before selling his flock and purchasing a ticket to Tangier, in northern Africa, to which he travels by boat. Shortly after he arrives there, a thief steals all of Santiago's money, so the shepherd boy decides to look for a way to make enough money to return home. He finds work in the shop of a crystal merchant, where Santiago makes improvements that reap considerable financial rewards.
After eleven months of working in the shop, Santiago is unsure of how to proceed. Should he return to Andalusia a rich man and buy more sheep? Or should he cross the vast Sahara in pursuit of the hidden treasure of his dreams? He joins a caravan traveling to Egypt.
Santiago meets an Englishman who wants to learn the secret of alchemy, or turning any metal into gold, from a famous alchemist who lives at an oasis on the way to the pyramids. While traveling, Santiago begins listening to the desert and discovering the Soul of the World. The caravan eventually reaches the oasis, and there Santiago meets an Arab girl named Fatima and falls in love with her instantly. The caravan leader gathers the travelers together and tells them that tribal warfare prevents them from continuing their journey.
Santiago wanders from the oasis into the desert and, seeing two hawks fighting in the sky, has a vision of an army entering the oasis. Because attacking an oasis is a violation of the rules of the desert, Santiago shares his vision with the oasis's tribal chieftain. Soon afterward, Santiago is confronted by a black-garbed, veiled stranger with a sword, who sits atop a white horse. It is the alchemist. The tribal chieftain arms his men, and they are well-prepared when the oasis is indeed invaded. The alchemist offers to cross the desert with Santiago.
Soon the two men enter into an area of intense tribal warfare. Warriors hold the two men captive, but eventually allow them to continue their journey. The alchemist tells Santiago that he needs to return to the oasis, and that the rest of the trip is Santiago's to make alone so that he can claim his Personal Legend.
Santiago arrives at the Egyptian pyramids and begins to dig. He finds nothing buried in the ground. Thieves beat Santiago and rob him of his money. After he tells them of his dream, though, one of the thieves recounts his own dream about a buried treasure in the sacristy of an abandoned church.
Returning to Andalusia, Santiago goes back to the church where he dreamed of the treasure near the pyramids. He digs where he slept, beneath a sycamore tree, and there it is: Santiago's treasure.