Masjid Jinn, also known as Masjid Haras, is built on the spot where the Prophet (saw) drew the line for Abdullah ibn Mas’ud (may Allah be pleased with him), who accompanied him after he was told to read the Qur’an to the Jinn.
Abdullah bin Masood (may Allah be pleased with him) says: “While in Mecca, the Prophet (saw) once said to the Sahaba (may Allah be pleased with them):“ Whoever wants to see the Djinn ”should come along.” Except me, no one came. When we reached a place in Mala a place in Mecca, the Prophet (saw) used his foot to draw a circle on the ground. Then he instructed me to sit inside the circle. Going a little further, the Prophet (saw) began to read from the Quran. Then it happened that the Jinn began to arrive in troops when they gathered there. They are many to the extent that I couldn’t even see the Prophet (saw) and not hear from him. Then the Prophet (saw) continued to talk with a group of these Jinn until Fajr. [Tafsir ibn Katir]

Abdullah ibn Masood (may Allah bless him) also said that the Prophet (saw) said: “The caller from among the jinn came to me, and I went with him and read Al- Quran to them.” He further explains that the Prophet (saw) took them and showed them their footsteps and the traces of their fires. They asked for provision from Him, and he prayed to Allah and said to them: “You will have every bone on which the name of Allah was mentioned; when it falls into your hands, there will be a lot of meat on it. And all droppings are food for your animals. ” Then the Prophet (saw) said: “Do not use them (bones and dung) to cleanse yourself after relief, because they are the food of your brothers.” [Sahih Muslim]
Sources: The History of Makkah Mukarramah – Dr Muhammad Ilyas Abdul Ghani