The djinni (plural djinn) is a monster in NetHack. It is only generated on the Plane of Air. It can be found elsewhere by rubbing a magic lamp or drinking a smoky potion. A djinni generated this way might be tame, peaceful, or hostile; or it might simply disappear, sometimes granting a wish first. A tame djinni makes a powerful pet in the early game -- it is intelligent and will use weapons -- but a wish is almost always more useful. Blessing the lamp or potion will increase the odds of receiving a wish.

Djinn are never randomly generated and besides the three that appear on the plane of air, only come from quaffing smoky potions, rubbing magic lamps, applying figurines of djinn, or casting stone to flesh on
a statue of a djinni.

The following messages can occur when you release a djinni from a magic lamp or smoky potion, or a monster releases a djinni from a smoky potion. See those articles for more details on the relative frequency of each.

The djinn are genies from the elemental plane of Air. There,
among their kind, they have their own societies. They are
sometimes encountered on earth and may even be summoned here
to perform some service for powerful wizards. The wizards
often leave them about for later service, safely tucked away
in a flask or lamp. Once in a while, such a tool is found by
a lucky rogue, and some djinn are known to be so grateful
when released that they might grant their rescuer a wish.