With the advent of central banks, the management and creation of money became centralized. No longer did different banks, cities or regions issue their own securities, but money creation was put in the hands of the government. When issuing a gold-backed currency, the central bank had to keep a certain amount of gold as backing in the vault. Especially in Western economies, a lot of gold was managed in this way by central banks.
When the gold standard was abandoned in many countries in the 1930s, central banks decided to hold their gold reserves as a kind of safety net in case a banking crisis broke out. It also acted as a reserve that countries could use to import goods if the currency was not accepted abroad.