When the magnetic field from a current carrying wire suddenly interacts with another magnetic field then a force appears whose direction depends on how the field lines can adapt. Magnetic field lines do not merge, so when opposed arrows met, one of the lines must jump to a new position. In the case above, the circles cannot jump to anywhere but the downwardly bent lines can. As the bottom lines jump above the wire, a downward force on the wire appears. This force is the basis of the operation of electric motors, meters and loudspeakers etc.
Bar magnets have North and South Poles.
Like Poles repel and unlike Poles attract. The Earth acts as if it has a big magnet inside it. An electric current has a magnetic field associated with it. Winding a wire into a helix forms the coiled tube called a solenoid. An electromagnet is a solenoid with an Iron core.