Chapter-4|Moving Charges and Magnetism| NCERT 12th Physics:
The space in the surrounding of a magnet or a current carrying conductor in which its magnetic influence can be experienced is called magnetic field.
In summer’s of 1820, HC Oersted’s by his experiment concluded that a current carrying conductor detects magnetic compass needle place near it.
This experiment shows that the magnetic field is produced due to electric current. Electric current means moving charge, So it can be concluded that moving charges produce magnetic field in the surroundings.