The spin properties of exciton polaritons in a micropillar cavity placed in a static magnetic field and excited by a resonant light wave are studied theoretically. Owing to the Zeeman effect, a nonlinear polariton system has two branches of optical response that are characterized by opposite circular polarizations. An indirect mechanism of polarization reversal is predicted, according to which the current state of the system undergoes a transition to dynamical chaos, and then the alternative spin state is established spontaneously. Such spin switches, mediated by a chaotic stage, proceed in both directions near the same critical excitation amplitude, so that the sign of the circular polarization of the cavity radiation is directly determined by the intensity of the optical pump.