A control device for a rotating machine having a stator including a first winding set and a second winding set, the control device comprising: a relay (4,4a,4b) configured for supplying or interrupting current from a DC power supply; a capacitor (5,5a,5b) configured for suppressing variation in current supplied from the DC power supply; the relay (4,4a,4b) being connected between the DC power supply and the capacitor (5, 5a, 5b); relay control means configured for controlling opening and closing of the relay, control command generation means configured for generating a first control command that specifies current to flow through the first winding set, and a second control command that specifies current to flow through the second winding set; voltage calculation means configured for calculating a first voltage command from the first control command and calculating a second voltage command from the second control command; first voltage application means configured for applying voltage to the first winding set on the basis of the first voltage command; and second voltage application means configured for applying voltage to the second winding set on the basis of the second voltage command, characterized in that electric discharge control configured for electric discharge of the capacitor (5,5a,5b) is performed in a state in which the relay (4,4a,4b) is opened, while torque generated by current flowing from the capacitor (5,5a) to the first winding set and torque generated by current flowing from the capacitor (5,5b) to the second winding set are cancelled out with each other; wherein the first control command and the second control command are a first current command and a second current command in a rotating two-axis coordinate system, respectively, and the first current command and the second current command have phases opposite to each other. a relay (4,4a,4b) configured for supplying or interrupting current from a DC power supply; a capacitor (5,5a,5b) configured for suppressing variation in current supplied from the DC power supply; the relay (4,4a,4b) being connected between the DC power supply and the capacitor (5, 5a, 5b); relay control means configured for controlling opening and closing of the relay, control command generation means configured for generating a first control command that specifies current to flow through the first winding set, and a second control command that specifies current to flow through the second winding set; voltage calculation means configured for calculating a first voltage command from the first control command and calculating a second voltage command from the second control command; first voltage application means configured for applying voltage to the first winding set on the basis of the first voltage command; and second voltage application means configured for applying voltage to the second winding set on the basis of the second voltage command, characterized in that electric discharge control configured for electric discharge of the capacitor (5,5a,5b) is performed in a state in which the relay (4,4a,4b) is opened, while torque generated by current flowing from the capacitor (5,5a) to the first winding set and torque generated by current flowing from the capacitor (5,5b) to the second winding set are cancelled out with each other; wherein the first control command and the second control command are a first current command and a second current command in a rotating two-axis coordinate system, respectively, and the first current command and the second current command have phases opposite to each other.