I'm not sure if "hot" as "warm" or "heated" existed before "hot" came to mean "good-looking" or "attractive", but if so, how did this new meaning come to be?
According to OED 1, hot in the primary sense is 'common teutonic'. In the general sense of 'having or showing intensity of feeling; fervent, ardent, passionate, enthusiastic, eager, keen, zealous' OED's earliest citation is dated to 971, and Chaucer uses hot of sexuality before 1385:
Hot he was, and lecherous as a sparrow
It's obvious that what gets you hot may be regarded as hot itself; and in this transferred sense we again find Chaucer writing of hot spices. It's at least arguable that it's in the sense of 'exciting lust' that the Prose Merlin (ca. 1450) has:
This Morgain was a yonge damesell fressh and Iolye. But she was som-what brown of visage and sangwein colour, and nother to fatte ne to lene, but was full a-pert [folio 181a] auenaunt and comely, streight and right plesaunt, and well syngynge. But she was the moste hotest woman of all Breteigne, and moste luxuriouse . . .
The exact meaning here is debatable; I suspect it means 'passionate' or 'lustful' rather than 'sexually attractive';
but I would be surprised to find that hot was never used for 'sexually attractive' before the 20th Century.
EDIT I'm going to withdraw that last as superfluous, since for a woman to be 'hot' in the sense of 'lustful' or 'willing to copulate' is in itself an attraction, and has been for centuries:
What a devil hast thou to do with the time of the day? Unless hours were cups of sack and minutes capons and clocks the tongues of bawds and dials the signs of leaping-houses and the blessed sun himself a fair hot wench in flame-coloured taffeta, I see no reason why thou shouldst be so superfluous to demand the time of the day. - 1HIV,1,2
From etymonline for hot, “The association of hot with sexuality dates back to c.1500.” Also, “Sense of "exciting, remarkable, very good" is 1895 ... Hot stuff for anything good or excellent is by 1889.” The etymonline entry isn't clear about the dates of “warm” or “heated” meanings, but those apparently predate the other. OED 1 cites for the word in various senses of heated materials, or in forms like “hottest”, date from 1000 AD, 1200, 1250, 1300 etc; but the vowel frequently was a rather than o into the 1500's.
Also see the etymonline entry for red-hot, which notes “Red-hot mama is 1926, jazz slang, "earthy female singer," also "girlfriend, lover."”
The term "hot" has been so-long intertwined with sexuality that it practically predates writing. Despite the fine scholarship that has responded so far, I think we must look to the roots of the connection between "hot" and sexuality:
Carnal passion is an activity that raises the metabolic rate of each body, thus generating more heat. Even the anticipation of physical sex can raise the heat of one or more people — even those not involved in the 'chemistry' of the anticipated sexuality (e.g. proximal observers to a flirtatious encounter).
The biological function of sexual attractiveness is procreation, which in the human female involves elevated body temperature needed to ovulate a mature/fertile egg cell for conception.
Much later, religious ideology in the Christian institution would associate a 'self-interested and unrestrained devil' character with light/fire (thus: "Lucifer"), and also with an infernal and fiery state of life ("hell"). The conjunction of these mythos lead many to connect sexuality with fire.