Oersted invented the magnetic effect of current.
A magnetic field is the magnetic effect of electric currents and magnetic materials. The magnetic field at any given point is specified by both a direction and a magnitude (or strength); as such it is a vector field. We see that the needle is moving to one side after switching on the current on circuit. If we alter the electric connection, the needle of the compass will move the other side. From this effect, we can understand that a magnetic field is produced when a current flows through a wire.
It is seen that the dust of the iron will get them arranged like the figure. If you draw a dot using a small compass and added to it, you will find the same. If you change the direction of the current, the needle of the compass will direct the opposite side which will remain facing the opposite direction. So the flow of electricity produced magnetic field around the conductor also.