This building is the Shajarah mosque (Masjid of the tree) and is located opposite Masjid al-Jinn.
Masjid marks the spot from which the Prophet (saw) called the tree, and it came to him. Note that this Mosque should not be confused with the Mosque in Dhul Hulayfah, which is sometimes called the same name.

Umar (may Allah be pleased with him) reports that the Prophet (saw) was at Hajoon, when some Mushrikeen (non-believers) declined his invitation to Islam. The Prophet (saw) prayed: “O Allah! Show me such a sign, after which I will not worry about rejection of the people. ” Then he was ordered to call a tree. When the Prophet (saw) did this, a tree came to him and saluted him with Salam. Then he instructed tree to return, and he duly executed. After this, the Prophet (saw) said: “Now I don’t worry about the refusal of the people.”