The U.S. Dollar can be viewed as just a piece of paper or digits on a computer screen. Similarly, gold can be viewed as just a shiny piece of metal. The U.S. Dollar has value because people around the world want it. Without this global demand, the U.S. Dollar would have no value. Similarly, countries and societies around the world want gold as well. This demand is what drives the price of gold.
The demand for gold began at the dawn of civilization. Since gold must be extracted from the earth and cannot be manufactured at will, people used precious metals to store their wealth due to their limited supply. This practice continued throughout history and still continues today. With gold being traded on the global market and with no single country controlling it, gold's purchasing power has remained stable in the face of inflation.
Put another way, gold is a store of value that no country in the world can completely control, making it a useful tool for countries who want to safeguard their wealth against geopolitical risk.