If you look at
Chronology of the universe - Wikipedia , you will find an explanation of how it happened. During the electroweak epoch (between about 10^-32 and 10^-12 seconds after the beginning) the universe consisted of a hot quark-gluon plasma, with interactions between W and Z bosons and Higgs bosons. During this time, fermions and electroweak bosons were massless. During the subsequent quark epoch (10^-12 to 10^-5) seconds, fermions acquired mass, but energies were still too high for quarks to bind into hadrons. Production of hadrons (including protons and neutrons) began during the hadron epoch (10^-5 to 1 second).
By about ten seconds after the beginning, when the temperature had fallen to about a billion Kelvin, protons and neutrons were able to combine into the first atomic nuclei (hydrogen, deuterium, helium-3, helium-4 and lithium-7). The universe was still too hot for electrons to combine with atomic nuclei to form atoms; this had to wait until about 370,000 years after the beginning, when the temperature had fallen to about 4000 K.
Isn't this a more detailed account of the origin of matter than the statement that 'God created the heaven and the earth'? Doesn't it give a better explanation of the observed abundances of the light elements (hydrogen, helium and lithium) and of the cosmic microwave background?