Two species were created whom were given the power to choose what path they would take in life, humanity and the jinn. The jinn, though they lack an actual body, appear to take many different forms and are considered to draw their substance from a force they compare to smokeless fire. Just as it is seen that humanity was given dominion over the material world, jinn were considered to have an equal command of the unseen or invisible realm.
The jinn would be beings that for lack of a better term incarnate in the unseen world of the cause and effect web. On wish granting, one could gain favours from the jinn the same way one gains favours from humans. But the jinns favours seem magical because the jinn live in the unseen component of our world. Operate behind the scenes and can change things about the world we can’t because they change them from the other side.
“Which then of the bounties of your Lord will you deny? He created man from dry clay like earthen vessels, And He created the jinn of a flame of fire.” Quran (c. 651 AD)
“And I have not created the jinn and the men except that they should serve Me.” Quran (c. 651 AD)