Extremely high temperatures and extremely dense gravity are necessary for nuclear fusion to occur. The temperatures must be so hot and the gravity so dense that these conditions have not been re-created on Earth. The core of the sun, however, does have the appropriate conditions to ionize hydrogen atoms, which means the protons and electrons are ripped apart from the neutrons. The core of the sun is around 15 million degrees Kelvin (about 26 million degrees Fahrenheit).
The extreme heat causes hydrogen atoms to ionize and separate, but the dense gravity pulls them back together to form helium atoms. During nuclear fusion, 4 ionized hydrogen atoms combine with two electrons to form a helium atom. Additionally, 2 neutrinos (individual neutrons separated from the atom) and 6 photons (light particles) are created during this process. Nuclear fusion creates energy, which is what powers the sun, and subsequently heats up the core, feeding the reaction process.
The sun became a star when it became dense and hot enough to start nuclear fusion. Prior to that, the sun was merely a clump of dust and hydrogen gas (called a nebulae), which were remnants of a previous star. However, gravity caused the clump to condense and eventually pull in more matter, until it reached the point that it was hot enough for nuclear fusion to begin.
The sun cannot continue nuclear fusion forever; eventually, the hydrogen in the core will run out. As this happens, the core will actually get denser and hotter, and the helium will start to fuse into heavier elements, such as carbon and oxygen. However, because of the sun's mass, the carbon and oxygen will not fuse into larger elements (such as iron). By this time, the exterior layers of the sun will have drifted off, and all that will be left is an extremely hot and dense shell called a white dwarf.