What is a coil of wire that when carrying an electric current produces a magnetic field?

A solenoid. An electromagnet is wire wrapped around a core of iron (usually). The wrapped wire itself is called the solenoid.