A controller for rotary machine which controls a rotary machine which has two sets of plural-phase armature windings, via two sets of inverters (6a, 6b) connected to the same DC power source, the controller for rotary machine comprising: a distribution unit configured to calculate an utilization factor setting command related to setting of a first set of voltage utilization factor which is a ratio of an amplitude (V1amp) of a fundamental wave component of line voltages of applied voltages of first set of plural-phase armature windings with respect to a power source voltage (Vdc) of the DC power source, and a second set of voltage utilization factor which is a ratio of an amplitude (V2amp) of a fundamental wave component of line voltages of applied voltages of second set of plural-phase armature windings with respect to the power source voltage (Vdc); a first set voltage command calculation unit configured to calculate first set of plural-phase voltage command values, based on the utilization factor setting command; a second set voltage command calculation unit configured to calculate second set of plural-phase voltage command values, based on the utilization factor setting command; and a first set switching control unit configured to turn on and off a plurality of switching devices provided in the first set of inverter, based on the first set of plural-phase voltage command values, and configured to apply voltages to the first set of plural-phase armature windings; a second set switching control unit configured to turn on and off a plurality of switching devices provided in the second set of inverter, based on the second set of plural-phase voltage command values, and configured to apply voltages to the second set of plural-phase armature windings, wherein the distribution unit is configured to calculate the utilization factor setting command which makes an utilization factor ratio between the first set of voltage utilization factor and the second set of voltage utilization factor change from 1 to 1 so that an effective value of a bus line AC component which is an AC component superimposed on a bus current which flows through a bus line connecting between the DC power source and the two set of inverters (6a, 6b) becomes lower than a case where the utilization factor ratio is 1 to 1. a distribution unit configured to calculate an utilization factor setting command related to setting of a first set of voltage utilization factor which is a ratio of an amplitude (V1amp) of a fundamental wave component of line voltages of applied voltages of first set of plural-phase armature windings with respect to a power source voltage (Vdc) of the DC power source, and a second set of voltage utilization factor which is a ratio of an amplitude (V2amp) of a fundamental wave component of line voltages of applied voltages of second set of plural-phase armature windings with respect to the power source voltage (Vdc); a first set voltage command calculation unit configured to calculate first set of plural-phase voltage command values, based on the utilization factor setting command; a second set voltage command calculation unit configured to calculate second set of plural-phase voltage command values, based on the utilization factor setting command; and a first set switching control unit configured to turn on and off a plurality of switching devices provided in the first set of inverter, based on the first set of plural-phase voltage command values, and configured to apply voltages to the first set of plural-phase armature windings; a second set switching control unit configured to turn on and off a plurality of switching devices provided in the second set of inverter, based on the second set of plural-phase voltage command values, and configured to apply voltages to the second set of plural-phase armature windings, wherein the distribution unit is configured to calculate the utilization factor setting command which makes an utilization factor ratio between the first set of voltage utilization factor and the second set of voltage utilization factor change from 1 to 1 so that an effective value of a bus line AC component which is an AC component superimposed on a bus current which flows through a bus line connecting between the DC power source and the two set of inverters (6a, 6b) becomes lower than a case where the utilization factor ratio is 1 to 1.