Benefits of electromagnets over permanent magnets:
Variable current can affect the strength of an electromagnet's magnetic field. It has the ability to enhance or reduce its strength. This is not possible with permanent magnets.
Electromagnets are easier to produce.
Electromagnets have higher magnetic power than permanent magnets.
Reversing the direction of current flow in the solenoid can change the polarity of an electromagnet.