The electromagnetic crane is one of the many applications of electromagnets
The electromagnet is a device formed by an iron core surrounded by a solenoid (coil). When an electric current passes through the turns of the coil, a magnetic field is created, which causes the elementary magnets of the iron core to orient themselves, thus becoming magnetized and, consequently, with the property of attracting other ferromagnetic materials.
we have an electromagnet and a magnet with their respective field lines.
Note that in the electromagnet the field lines enter at one end and leave at the other, in the magnet, they enter one pole (south pole) and leave the other (north pole) in practically the same way. It was for this reason, to present behavior similar to that of a magnet when passed by an electric current, that this device became known as electromagnet.