"medieval chemistry; the supposed science of transmutation of base metals into silver or gold" (involving also the quest for the universal solvent, quintessence, etc.), mid-14c., from Old French alchimie (14c.), alquemie (13c.), from Medieval Latin alkimia, from Arabic al-kimiya, from Greek khemeioa (found c.300 C.E. in a decree of Diocletian against "the old writings of the Egyptians"), all meaning "alchemy," and of uncertain origin.
Perhaps from an old name for Egypt (Khemia, literally "land of black earth," found in Plutarch), or from Greek khymatos "that which is poured out," from khein "to pour," from PIE root *gheu- "to pour" [Watkins, but Klein, citing W. Muss-Arnolt, calls this folk etymology]. The word seems to have elements of both origins.
Mahn ... concludes, after an elaborate investigation, that Gr. khymeia was probably the original, being first applied to pharmaceutical chemistry, which was chiefly concerned with juices or infusions of plants; that the pursuits of the Alexandrian alchemists were a subsequent development of chemical study, and that the notoriety of these may have caused the name of the art to be popularly associated with the ancient name of Egypt. [OED]
The al- is the Arabic definite article, "the." The art and the name were adopted by the Arabs from Alexandrians and entered Europe via Arabic Spain. Alchemy was the "chemistry" of the Middle Ages and early modern times, involving both occult and natural philosophy and practical chemistry and metallurgy. After c. 1600 the strictly scientific sense went with chemistry, and alchemy was left with the sense "pursuit of the transmutation of baser metals into gold, search for the universal solvent and the panacea."
1560s, chymist, "alchemist," from French chimiste, from Medieval Latin chimista, reduced from alchimista (see alchemy). Modern spelling is from c. 1790. Meaning "chemical scientist, person versed in chemistry" is from 1620s; looser meaning "dealer in medicinal drugs" (mostly in British English) is from 1745.
c. 1600, "alchemy," from chemist + -ry; also see chemical (adj.). The meaning "natural physical process" is from 1640s; the sense of "scientific study of the composition of material things and the changes they undergo" is by 1788. Chemistry in the European mind disengaged itself from alchemy in the mid-1600s; The Academy del Cimento was established in Italy in 1657, the Royal Society in London in 1660, and the Academy of Sciences in Paris in 1666.
The figurative sense of "instinctual attraction or affinity" is attested slightly earlier, from the alchemical sense.