1650s, "tutelary spirit," from French génie, from Latin genius (see genius); used in French translation of "Arabian Nights" to render Arabic jinni, singular of jinn, which it accidentally resembled, and attested in English with this sense from 1748.
late 14c., "tutelary or moral spirit" who guides and governs an individual through life, from Latin genius "guardian deity or spirit which watches over each person from birth; spirit, incarnation; wit, talent;" also "prophetic skill; the male spirit of a gens," originally "generative power" (or "inborn nature"), from PIE *gen(e)-yo-, from root *gene- "give birth, beget," with derivatives referring to procreation and familial and tribal groups.
The sense of "characteristic disposition" of a person is from 1580s. The meaning "person of natural intelligence or talent" and that of "exalted natural mental ability, skill in the synthesis of knowledge derived from perception" are attested by 1640s.
1680s, djen, from Arabic jinn. It is a collective plural, "demons, spirits, angels;" the proper singular is jinni, which appears in English occasionally as jinnee (1840) but more frequently as genie. Similarity to genius is accidental.
Others are reading
<a href="https://www.etymonline.com/word/genie">Etymology of genie by etymonline</a>
Harper, D. (n.d.). Etymology of genie. Online Etymology Dictionary. Retrieved $(datetime), from https://www.etymonline.com/word/genie