Scientists in the past were not sure where heat was going during phase changes.
In the past scientists investigated how much heat energy was required to raise the temperature of substances (heat capacity). During these experiments they noted that heating objects (i.e. transferring heat energy to them) caused their temperature to rise. But when the substance changed phase its temperature stopped rising (this only happened during phase change). The problem was that heat energy was still being transferred to the substance during phase change and by gaining heat energy the scientists of the time believed the temperature should still increase.
So the substance was gaining energy but it was "hidden" from observers because the temperature was not rising. That is why they called the heat they transferred to the substance during phase changes "latent heat" (i.e. hidden heat).
We now know that increasing temperature is linked to increasing kinetic energy of the molecules and that during an ideal phase change there is no increase in kinetic energy of the molecules. During phase changes heat energy is absorbed/lost to break/form bonds, i.e. the molecules gain/lose potential energy.
When steam condenses to form liquid water it releases a lot of heat. Principally, the bonds between molecules are chemical. The formation of these bonds corresponds to the change in phase. Molecules that were free to wander are now joined with electromagnetic bonds and behave like a fluid. Molecules once in free motion with a lot of kinetic energy are now joined together and unable to move quite so far without transferring momentum to molecules near them.
Definitions of Energy vary a little by state standards. And scientists aren't always very good about using terms consistently. Chemists, for example, like to speak of entropy instead. If you are in a state which uses the SCREAM acronym, you may have the choices: Sound, Chemical, Radiant, Electrical, Atomic, and Mechanical. You could make a case for many of these so-called forms of energy playing a role in phase-change dynamics.
Depending on the context of the question and how deep you want to get into the theory, one could talk about kinetic energy, chemical energy, heat energy, electric or magnetic bond energy. Heat is really a consequence of the motion of many many molecules considered as a statistical whole. Individually, the molecules simply follow Newton's Laws and react to the net force acting on their mass at any time.
Latent heat is the energy (see note below) released or absorbed during a phase change, where the temperature does not change. This is because all of the heat is used up in the phase change, rather than into changing temperature.
For a more in-depth explanation specifically of latent heat of fusion, see the link
Latent heat is actually the total amount of enthalpy (a kind of energy) necessary to accomplish a phase change.
Phase changes are generally considered at constant pressure, rather than constant volume. Because a kg of say, 100°C steam, occupies a much greater volume than a kg of 100°C water, a lot of work has to be done to push the environment out of the way as that water expands to become steam. (The fact that vaporization does a lot of work is why we use steam to power a large number of the turbines in the world.)
Enthalpy, #H#, is a quantity that includes the energy #U# that goes into the substance in the new phase, plus the work, #W=P\DeltaV#, to expand or contract the substance into its new phase at the same pressure:
#H = U + P\DeltaV#,
where #P# is the ambient pressure, #\Delta V# is the change in volume, and #U# is the internal energy of the substance in its new phase. Latent heat of vaporization is typically much bigger than latent heat of fusion because of the much larger change in volume involved.