Fusion energy is similar to Fission (on which nuclear reactors depend) in that both are based on Einsteins famous equation E=MC^2. Pronounced as E equals M C squared. E is the energy released and M is the mass destroyed and C is the speed of light. How is the mass destroyed? Well, nuclear particles will bind to each other using the strong nuclear force and will be repelled because of electrostatic forces. Therefore, an atom is a complex interplay of forces holding the atom together and other forces pushing it apart. There is an optimum size for an atom, not too big and not too small. So, taking two small atoms and adding them together to make a larger one makes a more stable atom and mass is destroyed to make energy. This is called Fusion Energy. Taking a heavy atom that is above the optimum, somewhere near iron, and splitting it into smaller atoms also results in less mass and energy being released.
Thermonuclear fusion in a reactor requires a gas to be very hot, this can be achieved by using a fission reaction to provide the high temperatures such as seen in the Hydrogen bomb. The atom bomb is a fission reaction which is easier to produce and this heats hydrogen to very high temperatures and causes the atoms of hydrogen to fuse to create helium. This is the basis of the H-bomb and it is a more powerful source of energy than fission. Trying to contain a thermonuclear reaction inside a vessel in a continuous reaction is the holy grail for fusion research and would create a relatively cheap and safe nuclear energy technology. It is just possible to make this work using a magnetic bottle to confine the gas. The magnetic bottle works because at very high temperatures all the electrons are knocked off the atoms to form a dense plasma. The atoms without electrons in a plasma are called ions and they are directed by the magnetic and so can avoid hitting the walls and melting the chamber.
The main alternative to magnetic confinement is inertial confinement, here the gas is heated so quickly that the gas does not have time to get to the wall and melt it. This is a non-equilibrium reaction so it can be called non-Thermonuclear fusion. Lasers can be used to heat and confine the materials and high energy beams can also be used.
Both Thermonuclear and Inertial Confinement have been shown to work and JET, the joint European thermonuclear reactor has produced many megawatts of fusion energy for several seconds. However, the next experiment, ITER is under construction and will take several decades to complete. There is a joke in fusion research that a reactor is 20 years away no matter when you start the clock.