This building is Masjid Shajarah (Masjid of the tree) and is located opposite Masjid al-Jinn. The Masjid marks the spot from where the Prophet (ﷺ) called a tree and it came to him. Note that this masjid is not to be confused with the masjid in Dhul Hulayfah which is sometimes referred to by the same name.
- Umar (رضي الله عنه) reports that the Prophet (ﷺ) was onced at Hajoon when some of the Mushrikeen (disbelievers) rejected his invitation to Islam. The Prophet (ﷺ) prayed, “O Allah! Show me such a sign after which I would have no concern for the rejection of the people.” He was then told to call a nearby tree to him. When the Prophet (ﷺ) did so, the tree came to him and greeted him with Salam. He then instructed it to return and it duly complied. After this the Prophet (ﷺ) said, “I now have no concern for the people’s rejection.“
References: The History of Makkah Mukarramah – Dr. Muhammad Ilyas Abdul Ghani