Some helium is the result of nuclear fusion of hydrogen in stars,
but most was formed in conditions shortly after the Big Bang.
The initially-very-hot universe descended through temperatures
that produced a particular ratio of neutrons and protons,
which at a cooler temperature, combined into low-mass isotopes,
including a very stable helium isotope (mass number 4, helium-4),
much of which remained as the temperature cooled further.
Helium's precise primordial abundance, Yp ("Y"
standing for a mass fraction of helium) is a subject of study.
Theory of Big Bang nucleosynthesis produces a Yp value which observations/analysis
confirm and refine.
Methods of determining Yp include determining
a ratio of changes in the abundance of helium and metals
(to extrapolate backwards)
and observing/analyzing very early HI regions
at a time when metallicity was low.