Ah, electromagnetism. This fundamental interaction of matter is so much more important than most would believe. Like gravity, the effects of electromagnetism have always been known by humankind, in one form or another. However, it wasn’t until way, way later that we found out what it truly was, or how integral it is to the existence of... well, everything. It took a man by the name of James Clerk Maxwell to get science on its way. He published his Treatise on Electricity and Magnetism in 1873, pointing out several interconnected properties between the two phenomena, like:
Point 1: Electric charges of different sign (positive, negative) attract, and like ones repel. The same goes with magnetic poles: north pulls south, and pushes away other norths.
Point 2: Running an electric current through a wire creates a magnetic field. Likewise, moving a magnet through a loop of wire creates an electric current.
What he had described was the newly understood phenomena called... electromagnetism.