jinn (Arabic: جن jinn, singular جني jinnī; variant spelling djinn) or genies are supernatural creatures in Arab folklore and Islamic teachings which occupy a parallel world to that of mankind. Together, jinn, humans and angels make up the three sentient creations of Allah. According to the Qur’ān, there are two creations that have free will: humans and jinn. Religious sources say barely anything about them; however, the Qur’an mentions that jinn are made of smokeless flame or "scorching fire". Like human beings, the jinn can also be good, evil, or neutrally benevolent.
The Arabic root j-n-n means 'to hide, conceal'. A word for garden or Paradise, جنّة jannah, is a cognate of the Hebrew word גן gan 'garden', derived from the same Semitic root. In arid climates, gardens have to be protected against desertification by walls; this is the same concept as in the word paradise from pairi-daêza, an Avestan word for garden that literally means 'having walls built around'. Thus the protection of a garden behind walls implies its being hidden from the outside. Arabic lexicons such as Edward William Lane's Arabic-English Lexicon define jinn not only as spirits, but also anything concealed through time, status, and even physical darkness. .
The word genie in English is derived from Latin genius, which meant a sort of tutelary or guardian spirit thought to be assigned to each person at their birth. English borrowed the French descendant of this word, génie; its earliest written attestation in English, in 1655, is a plural spelled "genyes." The French translators of The Book of One Thousand and One Nights used génie as a translation of jinnī because it was similar to the Arabic word in sound and in meaning. This use was also adopted in English and has since become dominant.
Jinn in the pre-Islamic era
Types of jinn include the shayṭān, the ghūl, the marīd, the ‘ifrīt, and the jinn. According to the information in the Arabian Nights, ‘ifrits seem to be the strongest form of jinn, followed by marids, and then the rest of the jinn forms.
A few traditions (hadith), divide jinn into three classes: those who have wings and fly in the air, those who resemble snakes and dogs, and those who travel about ceaselessly. Other reports claim that ‘Abd Allāh ibn Mas‘ūd (d. 652), who was accompanying Muhammad when the jinn came to hear his recitation of the Qur’an, described them as creatures of different forms; some resembling vultures and snakes, others tall men in white garb. They may even appear as dragons, onagers, or a number of other animals
Relationship of King Solomon and the genies
According to traditions, the jinn stood behind the learned humans in Solomon's court, who in turn, sat behind the prophets. The jinn remained in the service of Solomon, who had placed them in bondage, and had ordered them to perform a number of tasks.
"...and there were jinn that worked in front of him, by the leave of his Lord," (Qur’an 13:12)
"And before Solomon were marshalled his hosts,- of jinn and men and birds, and they were all kept in order and ranks." (Quran 27:17)
The Qur’an relates that Solomon died while he was leaning on his staff. As he remained upright, propped on his staff, the jinn thought he was still alive and supervising them, so they continued to work. They realized the truth only when God sent a creature to crawl out of the ground and gnaw at Solomon's staff until his body collapsed. The Qur’an then comments that if they had known the unseen, they would not have stayed in the humiliating torment of being enslaved.
"Then, when We decreed (Solomon's) death, nothing showed them his death except a little worm of the earth, which kept (slowly) gnawing away at his staff: so when he fell down, the jinn saw plainly that if they had known the unseen, they would not have tarried in the humiliating Penalty (of their Task)." Qur’an 34:14)