While there are several reasons why people buy gold, the main one is as a hedge against inflation. That said, stocks tend to beat gold at its own.

Source: www.nasdaq.com