The bonfire is not a "good fire." It is a bone fire, and for centuries that was exactly what it burned.
The evidence is unusually clear. An English-Latin word list of 1483, the Catholicon Anglicum, lists "a Banefyre" and translates it as ignis ossium, "fire of bones." Bane was the old spelling of bone, and it stayed common in Scotland long after. Etymonline dates the word to the late 1300s, in forms such as bonfir and banefire.
John Mirk's book of sermons, quoted by Merriam-Webster from a 1486 printing, describes three fires lit in honour of St John. One was made of "clene bones & no wode," and Mirk calls it a bone fire. Another was only wood. The third mixed the two, and Mirk says it "is called saynt Iohannis fyre." These fires burned on St John's Eve, around midsummer, and in 1575 the cooks of Newcastle were still required to keep bone-fires on Midsummer Eve.
So where did the "good fire" idea come from? Samuel Johnson's Dictionary of 1755 defined a bonfire as a fire made for public triumph and derived it from French bon, "good." Noah Webster repeated him. Merriam-Webster says it took until the 1890 Webster's International Dictionary for the mistake to be corrected.
There were good reasons to doubt Johnson. A French adjective glued to the native English word fire would be odd. Merriam-Webster also notes that French bon usually became boon in English, as in "boon companion."
Other theories have come and gone. The etymologist Anatoly Liberman reviews a link to Danish bavn, "beacon," and rejects it. He also considers "bale-fire" possible but unlikely. His conclusion is plain: "bonfire is indeed a bone-fire."
The bones themselves faded from memory. Etymonline says the bone-burning sense was forgotten by the 1700s. Already by the mid-1500s a bonfire could be any big open-air fire for public celebration, and later any large fire at all.
In Britain, bonfires now mark the Fifth of November, the anniversary of the Gunpowder Plot of 1605. The bones are long gone.