If a photon [is] massless then it must have no energy
This is not the case. One way to think of mass is as nothing more than a convenient name for rest energy. Photons are indeed massless and thus have zero rest energy. This is not an issue because according to special relativity, they do not come with a rest frame.
Please note that assuming we denote rest mass by $m$, the well-known $E=mc^2$ is not the whole story - the general formula reads
E^2 = m^2c^4 + p^2c^2
In principle, you could think of three types of particles, depending on the relative values of energy and momentum:
- $E^2 > p^2$: massive particles, $v < c$
- $E^2 = p^2$: massless particles (eg photons), $v = c$
- $E^2 < p^2$: tachyonic 'particles', $v > c$
The last variant is hypothetical and not really particle-like (they cannot be properly localized and would manifest more like an action-at-a-distance).
what are photons made of
As far as we know, they are elementary particles. They are excitations of a bosonic quantum field and not made out of anything.
how are they created
Through processes that involve the electromagnetic interaction in general and accelerating, vibrating or jumping electrons in particular.