The idea of dragons and other mythical animals living in caves is rather old. Maybe the connection is only the fear of the people: the fear of strange animals and dark unknown places.
But first scientific research produced also some strange results: the bones found in the caves had no connection with any known animal. Even the famous mayor of Magdeburg, Otto von Guerike, thought the bones were from an unicon. There was a rather weird drawing by Leibnitz who reconstructed the skeleton of a unicorn from cave bear bones, which he accepted without hesitation. The genius who discovered electricity, the vacuum (Magdeburg two hemispheres experiment), invented the barometer and the air pump, still failed with simple cave bear bones.
But it was a typical error of that times. Today we are astonished that Asians believe in the magic powers of the horn of the unicorn and hunt the last rhinos to get them. They pay so enormous amounts of money, that poachers do anything to get them.
Our European ancestors were rather similar to today's Asians. The bones of bone caves, especially cave bear bones, were interpreted as the bones of magical animals, mostly unicorns or dragons. The pharmacists of that time used them to make medicine. It is reported that the unicorn bones of the Einhornhöhle in Germany were mined to supply several pharmacies of the area.
However, there are lots of Dragon Caves and Unicorn Caves in Europe, and in most cases you can be sure that there once was an enormous amount of bones inside the cave. That's how they got their name. Some of the caves still have vast layers of bones, but most were mined, either for the mystical bones or even weirder, as fertilizer.