Yes, at first sight it doesn’t make much sense. The key is in how tightly the protons and neutrons are held together. If a nuclear reaction produces nuclei that are more tightly bound than the originals then energy will be produced, if not you will need to put energy in to make the reaction happen.
It turns out that the most tightly bound atomic nuclei are around the size of iron (with 26 protons in the nucleus). That is, one can release energy either by splitting very large nuclei (like uranium with 92 protons) to get smaller products, or fusing very light nuclei (like hydrogen with just one proton) to get bigger products. In both cases the reaction shifts the size of the atoms involved towards iron, that is towards lower energies in the “valley” pictured below. The energy gain is released in the form of kinetic energy of products (which usually converts to heat – random motion in the medium).
Why is it that mid-sized nuclei have an optimum structure from the energetic point of view? A simple “liquid drop model” of the nucleus gives an answer: Fusion of two small nuclei is energetically advantageous, because the joint nucleus has a smaller surface area than the two original nuclei – the same principle applies for droplets (e.g.of mercury). Indeed, the short-distance chemical forces between molecules of a liquid are similar to the short-distance “strong force” that keeps nuclear particles together. However, when a nucleus is too big, the long-distance electrostatic (Coulomb) repulsion between the positive protons sums up and becomes too strong. That is why very large nuclei (transuraniums) are unstable. For nuclei bigger than iron the overall energy loss due to mutual repulsion is more important than the energy gain due to smaller surface.