The law that relates the magnetic field around a closed loop to the electric current passing through it is Ampère's law. More precisely, Ampère's circuital law says that the circulation of the magnetic field around a closed path is proportional to the net current enclosed by that path.
The law grew from Hans Christian Ørsted's 1820 discovery that an electric current deflects a compass needle. André-Marie Ampère then investigated forces between current-carrying wires, while James Clerk Maxwell expressed the relationship in a broader mathematical framework. Ampère's law became one of the foundations of classical electromagnetism.
In its original form, the law works for steady currents, known as magnetostatics. Maxwell later added the displacement-current term, producing the Ampère–Maxwell law, which also handles changing electric fields, such as the field between the plates of a charging capacitor.
A common mix-up is with the Biot–Savart law. Both connect currents and magnetic fields, but Biot–Savart calculates the field contribution from current elements, whereas Ampère's law uses a closed-loop circulation and enclosed current.