We consider the topology optimization of a rotating electric machine in magnetoquasistatic operation in two space dimensions. This amounts to a topology optimization problem subject to a parabolic PDE constraint on a moving domain which we intend to solve by means of the topological derivative concept. For that purpose, we consider a topological perturbation of the materials in the space‐time cylinder along a trajectory given by the rotation of the machine. Using a Lagrangian approach, we derive the topological derivative formula, which depends on the solution of an exterior problem that is bounded in time and unbounded in the space directions. We use this sensitivity information for the design optimization of an electric motor by means of a level set method.