Electricity and magnetism are closely related to each other. The current flowing through the wire produces a circular magnetic field outside the wire. The direction of this magnetic field depends on the electric current.
Similarly, a changing magnetic field produces an electric current in a wire or conductor. The relationship between electricity arid magnetism is called electromagnetism.