To rotate a rotary body at a constant velocity, a swing control device of an electric rotary excavator controls rotation of the rotary body with a small first torque command value. By contrast, when operating a swing lever for acceleration, the rotation is controlled with a larger second torque command value. The first torque command value is generated based on a deviation between a velocity command value for an electric motor that rotates the rotary body and a measured velocity of the rotary body, and the second torque command value has a larger absolute value than the first torque command value and is obtained by adding a feed-forward torque command value to the first torque command value.