Gold was present in the deeps of Arda since its creation by Eru. It was no doubt discovered by Aulë, the great smith who was the first to make use of it. Afterwards, it was used by all speaking peoples of Arda, particularly the Dwarves and the Ñoldor.
It was used as currency and jewelry, among other things. It was to be found all over Arda, particularly in mountainous places where the Dwarves lived and worked. Many dragons coveted gold.
The great smiths of the Dwarves and elves would forge gold in incredible works of skill and beauty, gilding great armors and weapons, as well as crafting amazing jewelry. Even the Vala prized and appreciated gold, working some of the greatest artifacts known.