Interestingly the first mention of Baphomet (that I can find, at least) seem to be in an occitan poem about the Crusades, attributed to Gavaudan (presumably written in 1195):
Profeta seran Gavaudas
Quel digz er faitz. E mortz als cas!
e Dieus et honratz e servitz
on Bafometz era gravitz (V, 64-6)
(Gavaudan will be prophet in this: the words will become deeds. And death to the dogs! And God will be honoured and served where Baphomet was thanked.)
Extract from Catherine Léglu "Moral and satirical poetry" in The troubadours: an introduction
In this extract, it is relatively clear that the word Bafometz was just an occitanisation of the name Mahomet. And it's probably what was meant when the templars were accused of worshiping 'bafometic icons' (which was therefore a preposterous accusation but that's another question). After that, the idea that templars were worshiping an heretic figure called Baphomet probably remained in the collective imagination.
The modern representation of Baphomet, used by modern satanism, seems to originate from Éliphas Levi (1854) 'Dogme et Ritual de la Haute Magie' (Part II). Its representation is on the frontispiece of the book.
In the following extract he identify it with the Devil:
WE recur once more to that terrible number fifteen, symbolized in the Tarot by a monster throned upon an altar, mitred and horned, having a woman's breasts and the generative organs of a man – a chimera, a malformed sphinx, a synthesis of deformities. Below this figure we read a frank and simple inscription – THE DEVIL. Yes, we confront here that phantom of all terrors, the dragon of all theogonies, the Ahriman of the Persians, the Typhon of the Egyptians, the Python of the Greeks, the
old serpent of the Hebrews, the fantastic monster, the nightmare, the Croquemitaine, the gargoyle, the great beast of the Middle Ages, and – worse than all these – the Baphomet of the Templars, the bearded idol of the alchemist, the obscene deity of Mendes, the goat of the Sabbath. The frontispiece to this “Ritual” reproduces the exact figure of the terrible emperor of night, with all his attributes and all his characters.
And here is how he describes it:
The goat which is represented in our frontispiece bears upon its forehead the Sign of the Pentagram with one point in the ascendant, which is sufficient to distinguish it as a symbol of the light. Moreover, the sign of occultism is made with both hands, pointing upward to the white moon of Chesed, and downward to the black moon of Geburah. This sign expresses the perfect concord between mercy and justice. One of the arms is feminine and the other masculine, as in the androgyne of Khunrath, those attributes we have combined with those of our goat, since they are one and the same symbol. The torch of intelligence burning between the horns is the magical light of universal equilibrium; it is also the type of the soul, exalted above matter, even while cleaving to matter, as the
flame cleaves to the torch. The monstrous head of the animal expresses horror of sin, for which the material agent, alone responsible, must alone and for ever bear the penalty, because the soul is impassible in its nature and can suffer only by materializing. The caduceus, which, replaces the generative organ, represents eternal life; the scale-covered belly typifies water; the circle above it is the atmosphere, the feathers still higher up signify the volatile; lastly, humanity is depicted by the
two breasts and the androgyne arms of this sphinx of the occult sciences. Behold the shadows of the infernal sanctuary dissipated! Behold the sphinx of mediaeval terrors unveiled and cast from his throne!
Both above translations I found in Karlson-Weimann (2013) The Baphomet: a discourse analysis of the symbol in three contexts. What were the sources of Eliphas Levi's description however is unclear.