Electromagnetic waves are generated by an accelerating charge. When the wave is generated, the charge loses energy. Work is done by the charged object to generate the wave. This is the source of the energy.
This is also why transmitting antennae consume electrical power - the consumed power is converted to wave energy.
Once the wave is in motion, its energy remains constant unless it is consumed by absorption.
Regards