The present study employed direct numerical simulation to investigate the supersonic flow of Mach 3 in a bent pipe with a curvature of 0.0825, elucidating the dynamic mechanism of secondary motions within the turbulent boundary layer. The findings indicate that the compressible flow, affected by the wall curvature, is differentiated into several motion patterns as the bending angle increases: a portion of the outer fluid close to the wall, driven by the circumferential pressure gradient, moves inward through the lateral wall, causing an increase in the mass rate toward the lateral boundary layer and promoting the circumferential transport of energy and vorticity; other outer fluids at the start of the bent section, due to the centrifugal force, approach the wall to form a thinner boundary layer downstream; meanwhile, the fluid near the inner wall experiences the expansion, followed by the flow separation and reattachment at a bending angle of 14.6° and 22.0°, respectively, which induce a shear layer that develops from the inner end point toward the mainstream center, gradually reshaping the high-speed flow area within the pipe cross section into a U-shape, and enhancing the vorticity and temperature field of the inner region. Additionally, this study reveals a remarkable phenomenon that the separated flow in a localized inner region forms a rotating field, inducing vortices distinct from the mainstream Dean vortices in the low-speed flow region enclosed by the shear layer.