Answer: The thieves represent all those who try to take a short cut on their journey and who, in doing so, fail to realize their Personal Legend.
The thieves harm the boy, but they are also an important part of his journey; Santiago would not have found his treasure without them.
Explanation: Thieves in the Alchemist are portrayed as those who try to gain exclusively material values, so they try everything but not to live their Personal Legend, so they are unsuccessful in finding it, and therefore unsuccessful in finding material wealth. They did not want to get on the path of their Personal Legend, thinking they would be stupid if they believed in dreams. They thought it was crazy to go to Spain and find treasure beneath the old tree, just because they dreamed so. Instead, they decided to take away the valuables from travellers who came to see the pyramids.
Nevertheless, they are an important part of the journey of all those who have begun to search for their own Personal Legend, and so they are an important part of the young man's journey. Unconsciously, they helped a young man to discover where the treasure is in fact, even if they did not believe it. They are also an important part of everything a young man has learned on the journey of his Personal Legend.