Three quarters of the sun has hydrogen gas and one quarter has helium gas. It is over a million times as big as earth. Hydrogen atoms combine or fuse together to form helium under enormous pressure. This process is called nuclear fusion which releases enormous amount of energy as light and heat. It is this energy which makes sunshine and provide heat. The sun is situated at the centre of the solar system.
At the time of the Big Bang, hydrogen gas condensed to form huge clouds, which later concentrated and found numerous galaxies. Some hydrogen gas was left free in our galaxy. With time some changes occured due to which this free floating hydrogen gas concentrated and paved the way for formation of sun and the solar system