Stars are born in nebulae. Huge clouds of dust and gas collapse under gravitational forces, forming protostars. These young stars undergo further collapse, forming main sequence stars.
Stars expand as they grow old. As the core runs out of hydrogen and then helium, the core contacts and the outer layers expand, cool, and become less bright. This is a red giant or a red super giant (depending on the initial mass of the star). It will eventually collapse and explode. Its fate is determined by the original mass of the star; it will become either a black dwarf, neutron star, or black hole.