Primordial Nucleosynthesis
Image: Created by DALL-E
When the Universe is very young and still very hot, when quarks have gotten together into protons and neutrons but the latter have not decayed yet, and electrons are too excited to combine with protons to form atoms, protons and neutrons still have enough energy to smash into each other to generate elements heavier than hydrogen.
This occurs all over the Universe, which is expanding fast, and cooling down as a consequence of the expansion. This phase of generalized nuclear fusion goes under the name of Primordial Nucleosynthesis (also known as Big Bang Nucleosynthesis, BBN), and it builds up Deuterium and Tritium (heavy Hydrogen) from ordinary protons and neutrons, Helium and some traces of Lithium, by which time the Universe has become too cold for the reactions to continue.
The nuclei produced in this way stay around, inert and lonely, until the First Stars forms. From those, new elements are generated, cooked in their hot interiors. The amounts of the “primordial elements” -those cooked during BBN and pre-existing the First Stars- are a peculiar signature of the properties of the expanding Universe, and as such they have been used for several decades to test our Cosmological Model.
I studied many details of the process of BBN with the group in my hometown, publishing among others a Physics Report review available here, and a public code to compute the nucleosynthesis process, PArthENoPE .
If you are interested in the long-standing Lithium problem, you can find my opinion summarized here