The bacterial flagellar motor is a huge bidirectional rotary nanomachine that drives rotation of the flagellum for bacterial motility. The cytoplasmic C ring of the flagellar motor functions as the switch complex for the rotational direction switching from counterclockwise to clockwise. However, the structural basis of the rotational switching and how the C ring is assembled have long remained elusive. Here, we present two high-resolution cryo-electron microscopy structures of the C ring-containing flagellar basal body-hook complex from Salmonella Typhimurium,which are in the default counterclockwise state and in a constitutively active CheY mutant-induced clockwise state, respectively. In both complexes, the C ring consists of four subrings, but is in two different conformations. The CheY proteins are bound into an open groove between two adjacent protomers on the surface of the middle subring of the C ring and interact with the FliG and FliM subunits. The binding of the CheY protein induces a significant upward shift of the C ring towards the MS ring and inward movements of its protomers towards the motor center, which eventually remodels the structures of the FliG subunits and reverses the orientations and surface electrostatic potential of the αtorque helices to trigger the counterclockwise-to-clockwise rotational switching. The conformational changes of the FliG subunits reveal that the stator units on the motor require a relocation process in the inner membrane during the rotational switching. This study provides unprecedented molecular insights into the rotational switching mechanism and a detailed overall structural view of the bacterial flagellar motors.