Hans Christian Oersted a Danish Scientist in 1820 discovered a connection between them .He observed that the current flowing through a coil of wire produces a magnetic field around it.In this way he proveed that a magnetic field can be produced by an electric current.