Jinn reside in restrooms and one must keep the bathroom door closed to prevent them from entering the home. One should also recite [Oh God! I seek refuge with You from male and female devils] when entering the restroom.
[Allaahumma innee a`oodhu bika minal-khubuthi wal-khabaa’ith]
Afeez heard this superstition from his mother. As a child he was frequently chided for leaving the bathroom door open. He does not know whom his mother originally heard this superstition from, but he noted that he also heard it from a former ethics teacher when he went to a Muslim school. She told him that the shaiyateen (Jinn who harm humans) live in the bathrooms of homes.
This very likely derived from the times when restrooms were simply holes in the ground. There is a Hadith (a saying which Sunni Muslims attribute to the Prophet Mohammed) which states that one should not urinate in a hole because it is the residence of the jinn. When modern toilets and restroom facilities were created, it is likely that the superstition followed from the former belief.
The wider belief in jinn as spirits that antagonize humans is an old Middle Eastern belief. Many words, such as genie, derive from this and are used to describe spirits that can usually not be seen by humans yet can have an effect on outcomes for humans. The Jinn are purportedly created from smokeless fire and have the ability to conceal both their physical form and truths from humans. This gives them a great advantage which they use to create mischief amongst humans.
There are several classes of jinn, and they are responsible for various acts of evil amongst humans; however, jinn are said to lead lives similar to humans. They are said to marry, have families, die, follow religions, and have free will. The class of jinn that would reside in bathrooms is among the most abundant and longest lived. Shaiyateen are said to dwell in deserted, dirty places, some of them are said to have been alive as far back as the seventh century.