
...
Analysis of archival data from space missions shows that a large amount of heavy metals, including gold, come from giant flares from magnetars, according to a study published in The Astrophysical Journal Letters on April 29.
Anirudh Patel, a doctoral student at the Department of Physics at Columbia University in New York, led the study, which used 20-year-old archival telescope data from NASA and European Space Agency telescopes to investigate how heavy elements such as iron and gold were created and distributed throughout the universe.
“It’s a pretty fundamental question in terms of the origin of complex matter in the universe,” Patel was quoted as saying in an article on the NASA website. “It’s a fun puzzle that hasn’t actually been solved.”
...

Have scientists solved the mystery of gold’s origin in the universe?
A study gives clues to cosmic origin of gold and heavy elements, and they were created earlier than we thought.
So gold is essentially space poop.