A current carrying wire produces magnetic field. It is because, when current flows through a wire, electrons move inside it along a definite direction. On the other hand, in a wire which carries no current, electrons are in motion in random directions. Such a wire does not produce any magnetic field.