It is just like throwing a stone in pond full of water, for electronics stone is electron and water the medium, when stone is thrown in water crest and trough develop perpendicular to the direction of stone, the same way when current flows in a direction magnetic field is developed in perpendicular direction