As electric current passes through a conductor (e.g. electrical wire) there is always a magnetic field created around the conductor. This field, however, is extremely weak and cannot be used directly.
But if we wind a wire around an iron made stick, and pass current through the cable, an electromagnet is created. This electromagnet has magnetic properties only when current is passing though the cable.
The electromagnet therefore, is a device that converts
electrical energy into magnetic.
Electromagnets are used for lifting large metallic objects, as switches in electric circuits (relays), in electrical locks to open doors etc.