The Sun is actually a third generation star.
As for nuclear fusion, there are several pathways that the Sun takes. Our Sun mostly uses the proton-proton chain. It is a series of several steps that takes 4 hydrogen nuclei and fuses them into helium. Basically, two protons fuse together to make deuterium, than another proton fuses with it to create "light helium" (2 protons 1 neutron), and this light helium fuses with another light helium to produce regular helium (2 protons 2 neutrons) and two separate protons (hydrogen nuclei), with each step producing a few energy particles like positrons and neutrinos along the way.
This is only possible in the Sun because of its very large temperature in the core. Temperature is a measure of the average kinetic energy in a system, or the energy of motion. With a high temperature the atoms in the Sun swarm incredibly fast, by chance some of the atoms ram into each other and because of the high energies they posses from moving so fast they fuse together when they smash into each other. If they don't have enough energy or don't hit each other in the right way fusion will not occur.
Other, more massive, stars use other pathways like the CNO cycle that takes carbon and changes it through adding in various protons and those new atoms partially decaying ending with carbon12 which is the start of the cycle. Our Sun uses the CNO cycle a little bit, but not a lot, most of the energy comes from the proton-proton chain.
There are other pathways of nuclear fusion, but those are the most basic. It is all dependent on temperature, which in turn is determined by mass for main-sequence stars like the Sun.