Motion is relative, so you need to include a reference frame when determining the motion of an object. If a charged particle is in motion relative to the reference frame, then it produces a magnetic field, otherwise it only produces an electric field. This is a part of special relativity.