Current flowing in a wire produces a magnetic field around the wire. In a coil, the field from the adjacent turns is the same direction, so it adds up. That is why a coil of wire makes a much stronger magnet than one with fewer turns. The magnetic field line pattern looks very similar to that of a bar magnet.
Flowing current produces its magnetic field. Electricity and magnetism are very closely linked. All closed loop currents create their magnetic fields. If the wire or coil was a magnetic material in its field, the magnetic material may retain a magnetic field when the current wire is stopped.