The author is drawing a parallel between the novel's main character and himself. In the novel, the Spanish shepherd boy Santiago, is told that he will discover a treasure. He travels to Egypt to find it but it turns out that the treasure was actually buried in his native Spain. To explain the parallel, it is useful to expand the quote (from Oprah.com):
When The Alchemist was first published twenty-five years ago in my native Brazil, no one noticed. (...) By the end of the year, it was clear to everyone that The Alchemist wasn't working. My original publisher decided to cut me loose and cancelled our contract. They wiped their hands of the project and let me take the book with me. I was forty-one and desperate.
But I never lost faith in the book or ever wavered in my vision. Why? Because it was me in there, all of me, heart and soul. I was living my own metaphor. A man sets out on a journey, dreaming of a beautiful or magical place, in pursuit of some unknown treasure. At the end of his journey, the man realizes the treasure was with him the entire time. I was following my Personal Legend, and my treasure was my capacity to write.
In the above quote, Coelho was also looking for a "treasure", namely his capacity to write, which he was probably beginning to doubt when The Alchemist sold very few copies during the first year and his publisher cancelled their contract.
On Oprah.com, the text continues,
As I wrote in The Alchemist, when you want something, the whole universe conspires to help you. I started knocking on the doors of other publishers. One opened, and the publisher on the other side believed in me and my book and agreed to give The Alchemist a second chance. Slowly, through word of mouth, it finally started to sell—three thousand, then six thousand, ten thousand—book by book, gradually throughout the year.
People continue to ask me if I knew The Alchemist would be such a huge success. The answer is no. I had no idea. How could I? When I sat down to write The Alchemist, all I knew is that I wanted to write about my soul. I wanted to write about my quest to find my treasure.
Coelho compares his search for a publisher who believed in his novel with Santiago's search for his treasure. In this sense, the author was living the "metaphor" described in his novel.
Strictly speaking, though, The Alchemist is not a metaphor but an allegory. See Allegory at LiteraryDevices.net, where the novel is listed as one of several examples; and Review: Gender and Allegory in the Alchemist by Alessandra Prunotto (6 February 2017).