Gold had its demand from ancient times when the metal was widely used as ornament, a symbol of wealth and medium of exchange. It was widely accepted since the value it bore was much higher in proportion to its weight, carrying it was comparatively easy and it was widely accepted as a medium of exchange.
Once the trade activities increased within and across borders, carrying loads of gold became difficult. Also, there were safety concerns that forced traders to deposit their gold with a goldsmith who issued a deposit slip that mentioned the value of gold deposited and a promise to return the gold when the receipt was produced. Later these receipts paved the way for promissory notes which carried the same promise but on wider geography. A new trend emerged in which people were more comfortable carrying these paper gold promises than physical coins and bars.
Gold continued to get dumped in vaults which generated no further value. Goldsmiths by then had grown big to become large deposit houses. They thought of lending gold to people who are in need of wealth to transact. An interest was levied on such loaned out gold. This became an earning source for these bankers.
Earlier, the overall money (value of promissory note) in circulation was equal to the value of physical gold deposited in the vaults of banks in that region. Later when demand for promissory notes grew beyond a level, the gold standard was abolished and currency system gained acceptance globally. Thus physical gold slowly lead to paper money. Now a nation need not match the value of its currency with its gold deposit.