There was a *lot* of hydrogen created at the beginning of the universe (the Big Bang). It was not uniformly distributed over the whole universe, though. Some places had more hydrogen than others. In regions of space that that had a lot of hydrogen, the hydrogen atoms were pulled together by each other's gravity. Since hydrogen atoms are very small, the gravitational force on them is extremely small, so it takes a lot of them to exert a lot of force. Eventually, so much hydrogen was attracted to the same place that it created very high pressures, and some of the hydrogen atoms began to react with each other. That was when the Sun went from a life as a cloud of hydrogen to an actual star, producing light and heat. Our best estimates are that this happened between 4.6 and 4.7 billion years ago, based on calculations of gravity, nuclear physics (how quickly hydrogen converts to helium), and the current composition of the Sun (about 73% hydrogen, 25% helium, 2% oxygen and carbon and other elements).