YES, but there is no simple answer because this lies somewhere in the Cosmology of the campaign
The lore for metal-working is inevitably linked to the lore of tool-making, crafting and the rise of civilizationn. It is often bound in the histories of humanoids' dieties or a creation story. Most of these gods tend to have Knowledge as their suggested domain, but some have War and/or Creation. Most are Gods of Craft. Their gift to humanoids being the ability create, forge and build, or simply civilization. As most of D&D settings are fantasy or mythical ones, the rise into civilization of a race of humanoids is often inextricably linked to the history of particular dieties. This will vary from campaing to campaign, or even within a campaign as there can often be several competing creation stories. Often there is at least one god which provides humanoids with a gift, such as crafting.
For instance, you can look for clues in the PHB in the Appendix B (pp. 293-299), where there are some suggestions under the Cleric's Forge domain, a divine domain clearly linked with crafting:
The gods of the forge are patrons of artisans who work with metal,
from a humble blacksmith who keeps a village in horseshoes and plow
blades to the mighty elf artisan whose diamond-tipped arrows of
mithral have felled demon lords. The gods of the forge teach that,
with patience and hard work, even the most intractable metal can be
transformed from a lump of ore to a beautifully wrought object.
Clerics of these deities search for objects lost to the forces of
darkness, liberate mines overrun by ores, and uncover rare and
wondrous materials necessary to create potent magic items. Followers
of these gods take great pride in their work, and they are willing to
craft and use heavy armor and powerful weapons to protect them.
Deities of this domain include Gond, Reorx, Onatar, Moradin, Hephaestus, and Goibhniu.
Gods linked to Crafting (including metal-work)
- Gond (Forgotten Realms)
You can refer to the section Gods of Your World in the DMG (pp. 10-13) as this provides guidance about pantheons and the relationship between the divine and humanoids in 5e.
In the first section of Mordenkainen's Tome of Foes you will find a section on that races relationship with their gods.
Just as an example let's take the lucky-ole Halflings and their goddess, Yondalla.
The story of Yondalla begins at the dawn of the world, when halfiings were timid wanderers, scraping out a meager existence.
The goddess Yondalla took note of them and decided to adopt the
halflings as her people. [...] Yondalla created the first halfling
villages and showed the people how to build, plant, and harvest. (MToF
There is further lore about certain dieties in previous editions so you could build a world view of how this developed for your campaign, for instance in Legends & Lore from AD&D 2e there is extensive information about various pantheons, gods and avatars.
Otherwise, you could look at various creation myths for the various humanoid races in D&D and find more lore that way - however, you will inevitably come across the Gods of Craft, War and Creation!
I hope this helps.