Short answer
For the same reason as humans: to worship Him. "I did not create the jinn and mankind except to worship Me" (51:56). Jinn have free will, receive guidance and will be judged. Some heard the Quran from the Prophet ﷺ and believed (46:29).
Jinn are accountable (mukallaf) and the Prophet ﷺ was sent to them as well as to humans. A practical Hanafi ruling follows from this: cleaning oneself (istinja) with bone is makruh tahrimi, because bones were given to the believing jinn as food.
The four schools agree on this.
Explanation
The Quran puts jinn and humans together in the purpose of creation: "And I did not create the jinn and mankind except to worship Me" (51:56). Both were given choice, and both will be asked about it. On the Day of Judgement Allah will say: "O company of jinn and mankind, did there not come to you messengers from among you?" (6:130).
Jinn were created before humans, from "scorching fire" (15:27). The message of the Prophet ﷺ reached them: "We directed to you a few of the jinn, listening to the Quran" (46:29). They went back to their people as warners, and Surah al-Jinn records what they said: "We have heard an amazing Quran" (72:1).
Ibn Mas'ud reports a night when the Prophet ﷺ went out to the jinn and recited the Quran to them. They asked him for provision, and he said they would have every bone over which Allah's name had been mentioned. So he told his Companions not to clean themselves with bones or dung, as these are the food of their brothers among the jinn (Sahih Muslim). This is why Hanafi fiqh counts istinja with bone as makruh tahrimi.
Allah also uses jinn to show His power and to test people. Some served Sulaiman (34:12), and the evil among them tempt humans. Knowing they are fellow creatures with a duty to Allah removes much fear and superstition. Read Jinn in Islam, Are jinn the same as demons? and The purpose of life.
The evidence
Quran, Surah Adh-Dhaariyat 51:56
وَمَا خَلَقْتُ ٱلْجِنَّ وَٱلْإِنسَ إِلَّا لِيَعْبُدُونِ ﴿٥٦﴾
And I did not create the jinn and mankind except to worship Me.
Jinn, like humans, were created to worship Allah.
Quran, Surah Al-An'aam 6:130
يَٰمَعْشَرَ ٱلْجِنِّ وَٱلْإِنسِ أَلَمْ يَأْتِكُمْ رُسُلٌۭ مِّنكُمْ يَقُصُّونَ عَلَيْكُمْ ءَايَٰتِى وَيُنذِرُونَكُمْ لِقَآءَ يَوْمِكُمْ هَٰذَا ۚ قَالُوا۟ شَهِدْنَا عَلَىٰٓ أَنفُسِنَا ۖ وَغَرَّتْهُمُ ٱلْحَيَوٰةُ ٱلدُّنْيَا وَشَهِدُوا۟ عَلَىٰٓ أَنفُسِهِمْ أَنَّهُمْ كَانُوا۟ كَٰفِرِينَ ﴿١٣٠﴾
"O company of jinn and mankind, did there not come to you messengers from among you, relating to you My verses and warning you of the meeting of this Day of yours?" They will say, "We bear witness against ourselves"; and the worldly life had deluded them, and they will bear witness against themselves that they were disbelievers.
Jinn receive guidance and will be held to account.
Quran, Surah Al-Ahqaf 46:29
وَإِذْ صَرَفْنَآ إِلَيْكَ نَفَرًۭا مِّنَ ٱلْجِنِّ يَسْتَمِعُونَ ٱلْقُرْءَانَ فَلَمَّا حَضَرُوهُ قَالُوٓا۟ أَنصِتُوا۟ ۖ فَلَمَّا قُضِىَ وَلَّوْا۟ إِلَىٰ قَوْمِهِم مُّنذِرِينَ ﴿٢٩﴾
And [mention, O Muhammad], when We directed to you a few of the jinn, listening to the Qur'an. And when they attended it, they said, "Listen quietly." And when it was concluded, they went back to their people as warners.
Jinn heard the Quran and took it to their people.
Sahih Muslim 450
Sahih... لكم كل عظم ذكر اسم الله عليه ...
"You will have every bone over which Allah's name has been mentioned."
The Prophet ﷺ met and taught the jinn, and gave them a share of provision.
Where the ruling is recorded
- Radd al-Muhtar (Ibn Abidin), Fasl al-Istinja (section on cleaning after the toilet). Counts using bone for istinja among the disliked acts, citing the food of the jinn.
- Akam al-Marjan fi Ahkam al-Jann (al-Shibli al-Hanafi), Chapter on jinn being accountable. Explains that jinn are addressed by the Sharia.
Checked by our team. For a more accurate answer to your own situation, consult a scholar. Quran translation by Sahih International. Hadith Arabic from the standard editions of the six books and the Muwatta, with gradings as recorded there; the English is our own rendering. Spotted a mistake? Tell us.