Q: How did the first chemical element appear in the universe?
A: Immediately (much less than a second) after the Big Bang, the universe was both too hot and too dense for elements to form. Hydrogen didn’t appear until the universe had spread out — and subsequently cooled — enough for the first protons and neutrons, and later simple atoms, to form.
Between about 10-12 and 10-6 second after the Big Bang, neutrinos, quarks, and electrons formed. Protons and neutrons began forming shortly after, from about 10-6 to 1 second after the Big Bang. Within about 3 minutes after the Big Bang, conditions cooled enough for these protons and neutrons to form hydrogen nuclei. This is called the era of nucleosynthesis. Some of these nuclei combined to form helium as well, though in much smaller quantities (just a few percent). But after about 20 minutes, nucleosynthesis ended and no further nuclei could form.
The problem at this point was that electrons couldn’t stay in orbit around any atomic nucleus because of the immense heat and radiation still flooding the universe. Shortly after any neutral atoms would form (neutral atoms simply contain the same number of protons and electrons, and thus carry no overall charge), they were knocked apart again by energetic radiation.
Finally, after 380,000 years or so, the universe had again expanded and cooled enough for conditions to favor electrons staying in orbit around atomic nuclei. This is when recombination occurred — neutral hydrogen (and helium) finally appeared because they could “recombine with” (hold on to) electrons without easily losing them to stray radiation. If that number sounds familiar, it should — 380,000 years after the Big Bang is also the time when the cosmic microwave background was generated, because the atoms that formed entered their lowest energy state quickly after, releasing excess energy in the form of photons that could finally travel freely through the universe without knocking into anything along the way. This is the light that makes up the cosmic microwave background.