Galaxies, including our own Milky Way galaxy, contain vast amounts of gas and dust in inter-stellar space in the disk region. Regions called Giant Molecular Clouds (GMC’s) can extend over hundreds of light years and contain as much material as millions of Suns.
The gas is predominantly Hydrogen, the most abundant element in the Universe, but it also contains other gasses. The dust particles are microscopic and are largely composed of Carbon and Silicates. Generally these inter-stellar regions are cold enough for molecules to exist. Under influence of high-energy radiation from young hot stars, the gas can become ionised and then emits light, forming emission nebulae.
The process of star formation begins when a region of gas and dust becomes gravitationally unstable because a part of the cloud increases in pressure. This can be the result of a collision of different clouds, or be due to the shock wave of a supernova explosion (see below) or strong radiation of a nearby young massive star. On a grand scale this can happen when neighbouring galaxies interact and massive “star burst regions” are formed.
Star forming region in constellation Cygnus.
Infrared image by Spitzer Space Telescope.
Once this compression occurs, gravity can cause further contraction which results in rotating spheres of compressed gas called proto stars, in which the internal pressure can initially resist further collapse under gravity. When the proto star collects more material from an accretion disk that forms around it, the internal pressure can become so high that nuclear fusion starts. This blasts away material around the young star and can possibly start the process of planet formation.
This process of star formation occurs in very dynamic and often violent conditions of turbulence and high energy radiation and is very hard to model. The formation of a star of Solar mass can take a few million years, but very massive stars can develop in a few thousand years.
Through most of the star's life, energy is produced by Hydrogen fusion through a series of steps that ultimately convert hydrogen into helium. The inner region of the star, the core, is the only location in the star that is hot enough for this fusion process.
A self-correcting equilibrium
The rate of nuclear fusion depends very much on density and on temperature, so the fusion rate in the core is in a self-correcting equilibrium: a slightly higher rate of fusion would cause the core to expand slightly against the weight of the outer layers, reducing the fusion rate; and a slightly lower rate would cause the core to shrink slightly, increasing the fusion rate again.
The proton-proton cycle of Hydrogen fusion in a star.
Protons are the nucleus of Hydrogen atoms (red). They collide in various steps,
eventually producing a Helium nucleus (bottom).
The loss of mass in this process is converted into energy
in the form of gamma-radiation and neutrinos.
Image: Wikipedia (edited).
Inside the star, due to the high temperature, atoms are stripped of their electrons and only the bare nucleus can exist. So when we say that Hydrogen fuses to Helium, only the nuclei of these elements are involved.
It is a nuclear fusion process.