A Nova episode said that during stages of some moons' elliptical orbits, the moon is stretched, and friction causes the inside of the moon to heat up. I do not understand how this is compliant with the Law of Conservation of Energy - what energy would be lost to make the inside of the moon heat up?
The heat production inside moons is due to tidal heating. Due to this, the orbit of the moon would change.
The orbital and rotational energy of the moon is dissipated as heat either in the surface ocean or in the interior of the moon. This is especially seen in the moons of large planets, for example Io.
Io, being Jupiter's innermost moon, is pulled by Jupiter on one side and the other moons on the opposite side. Due to this, Io's orbit is highly elliptic. During this orbit, the shape of the Io changes continuously (the surface flexes by ~100m). This causes a large amount of friction in the moon.
Usually, the tidal heating leads to tidal dissipation and circularizes the orbit. However, it hasn't happened in Io because it is in orbital resonance with other moons of Jupiter.
If the orbital period of the moon is less than the rotational period of the planet, the moon is decelerated if the moons are out of the synchronous orbit, the opposite thing happens, conserving energy and angular momentum.
On the other hand, Europa, another of Jupiter's moons is tidally locked (it has same orbital period as the rotational period of the larger body) to the Jupiter, which causes tidal flexing on the surface.