For a much more detailed discussion of the origin of electromagnetic waves, see this blog post:
https://atomsandsporks.com/2018/08/05/the-saga-of-light-part-1-electromagnetic-radiation/
and, in general, be sure to check out the main website:
https://atomsandsporks.com/