Three discoveries challenged this foundation of magnetism, though. First, in 1819, Hans Christian Ørsted discovered that an electric current generates a magnetic field encircling it. Then in 1820, André - Marie Ampère showed that parallel wires with currents attract one another if the currents are in the same direction and repel if they are in opposite directions. Finally, Jean - Baptiste Biot and Félix Savart discovered the Biot -- Savart law in 1820, which correctly predicts the magnetic field around any current - carrying wire.
who discovered the direction of magnetic field lines
André - Marie Ampère