Studies of electricity and magnetism began in ancient times independently with the contribution of many scientists. Electricity is the branch that studies the processes related to the electric field and its source, which is the electric charge; for its part, the magnetism studies everything about the magnetic fields and their sources, that are the magnets. This was considered in this way until early in the 19th century, when Hans Christian Orsted obtained evidence of the relationship between the electricity and magnetism.
All of the blame is on the electric charge.
The casual result of an experiment of Orsted showed that an electric current (electric charges in motion) could create a magnetic field and change the orientation of a magnetic needle. From this moment the electric and magnetic phenomena began to be studied in their interrelation, giving rise to the branch of electromagnetism.
The maximum contribution to this unification was made by James Clerk Maxwell in 1861 when he established a group of four fundamental equations that demonstrated that electric fields and magnetic fields were manifestations of a single field, the "electromagnetic field". Also in their theoretical calculations, with the introduction of the concept of "displacement current" consisting of a variable electric field in time, he was able to discover the existence of electromagnetic waves, which consist of the propagation of electric and magnetic fields capable of self-generation.