Electromagnetism is one of the four fundamental forces of nature.
Understanding how it works gets quickly into some pretty deep stuff, but EM is largely well understood.
The Wiki page is a good intro, but it's a very big topic covering many fields of physics.