We first need to look at why fusion of hydrogen nuclei results in a lower energy state. On the face of it, hydrogen nuclei are just protons, which all carry an equal positive electric charge. This means they repel each other. So how do e.g. two protons and two neutrons ever fuse into a helium nucleus? The answer is that there is another force, the strong nuclear force, which acts between all protons and neutrons, attracting them together and allowing them to bind into larger nuclei. This attractive force is much stronger than the repulsive electrostatic force between protons; however, the strong nuclear force has a much shorter range than the electrostatic force. This means that in order for nuclei to get close enough to one another to bind via the strong nuclear force, they first need to overcome the electrostatic repulsion between protons, and this requires energy. If it helps think of it as two large spherical magnets separated by a hill. In order for them to attract one another, they first need to be pushed far enough up each side of the hill.
In practice, the amount of energy required to bring two hydrogen nuclei together in this way is very large, and so fusion mostly happens at the centre of stars, where the energies are enormous.