The dynamic response of a torsionally loaded pile embedded in heterogeneous soil is investigated in this paper based on a new theoretical model of the dynamic pile–soil interaction with consideration of the continuity of heterogeneous soil. By conceptualizing the surrounding soil as an elastic continuum with shear modulus following a power law variation along the depth, a new governing equation is established to portray the dynamic torsional deformation of the heterogeneous soil. With coupling of the pile motion under dynamic torque, the theoretical solution of the torsional dynamic impedance of an end‐bearing pile embedded in heterogeneous soil is obtained by employing analytical techniques. Comparative analyses under varied conditions are conducted to authenticate the applicability and superiority of the proposed theoretical model. Parametric studies are performed via extensive arithmetic examples to decipher the mechanism of torsional vibration of the end‐bearing pile in heterogeneous soil. Conclusively, the significant influences of soil heterogeneity along depth on the dynamic response of torsionally loaded piles are identified, and the characteristics of the cut‐off frequency of the dynamic damping are elucidated in detail. The outcomes attained herein can serve to formulate guidelines for design and facilitate the evaluation of pile performance in practical applications.