before vowels therm-, word-forming element meaning "hot, heat, temperature," used in scientific and technical words, from Greek thermos "hot, warm," therme "heat" (from PIE root *gwher- "to heat, warm").
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.
<a href="https://www.etymonline.com/word/thermochemistry">Etymology of thermochemistry by etymonline</a>
Harper, D. (n.d.). Etymology of thermochemistry. Online Etymology Dictionary. Retrieved $(datetime), from https://www.etymonline.com/word/thermochemistry