When investing the same amount every month (dollar-cost averaging), the difference becomes even larger. Using your portfolios, but adding $250/month in addition to the initial investment of $10k, you end up with $128k with gold and $207k with SPY (total investment ~$85k): https://www.portfoliovisualizer.com/backtest-portfolio?s=y&t... (with QQQ, it'd be $380k)
Comparing one-off investments is very dependent on the start date, and dollar-cost averaging more accurately models what people can actually do and which returns one may be able to expect. Who has a large lump sum laying around to invest rather than investing a portion of one's income every month/quarter?