With the gravitational shrinking of a gaseous nebula of material composed primarily of hydrogen, helium and trace amounts of heavier elements, a star's life begins. With the nebula shrinks, dividing into smaller clumps, atoms of light elements within the new star are squeezed under enough pressure for their nuclei to undergo fusion.
All stars are the result of a balance of opposing forces: the force of gravity compresses atoms in interstellar gas until the fusion reactions begin. Once the fusion reactions begin, they apply an outward pressure. As long as the inward force of gravity and the outward force generated by the fusion reactions are equal, the star remains secure.
As the star's core is thick, hydrogen changes into helium through nuclear fusion, releasing energy in the process. The star's internal pressure stops it from collapsing further under its own gravity. Without hydrogen and gravity as material, the formation of a star wouldn't be possible.