The earth came from the supposed "expansion" of the mass considered to be there before it -- expanded, didn't it?
Except the Earth and our Solar System didn’t form until 9 billion years later.
The Earth weren’t around when the earliest stars existed with the young universe, some 300-400 million years after the Big Bang.
9 billion years is a very long time, before the earth formed. The Solar System (including the Earth) from gases and dust and larger objects (planetesimals, asteroids, etc) from death of earlier stars (eg supernova).
Based on the composition of our Sun, it has higher metal contents than the earlier generations of stars.
Note that “metal” in astronomy and astrophysics of stars, have to do with elements heavier than helium, eg nitrogen, oxygen and carbon.
In the earliest generation of stars, the only elements in the very young universe were hydrogen, helium and trace amounts of lithium. So new and young and very massive stars were made mostly of hydrogen, and some helium.
Depending on the mass of the star’s core, Stellar Nucleosynthesis would either fuse hydrogen nuclei into helium, but stars more massive than our sun, can fuse together into nitrogen, oxygen or carbon.
Elements heavier than oxygen, usually occur when stars go through supernova explosions, which can create elements as heavy as iron, during the Supernova Nucleosynthesis.
There were no space dust and there were no planets or asteroids before the earliest stars and the earliest supernovas.
I would suggest that you look up "stellar population" for the generations of stars, and look up "metallicity", to understand what I am saying about "metal" and generations of stars.
Also look up Nucleosynthesis, how lighter elements can turn into heavier elements, like "proton-proton chain" (eg our Sun) & "CNO cycle", which are the 2 most common "Stellar Nucleosynthesis". There are many other types of Stellar Nucleosynthesis, like "triple-alpha process", which can convert helium nuclei into carbon atom.
And also look up "Supernova Nucleosynthesis".