A diffraction model based on the diffraction theory of elastic waves for the dynamic response of underground rectangular tunnel subjected to incident P waves is established. The rectangular structure is assumed to be a movable rigid body embedded in a homogenous, isotropic, and linear elastic medium. One particular advantage of the model is that the effects of vital factors such as the rigid scattering, radiation scattering, as well as the two‐dimensional scattering effect, and the wedge diffraction during movement are fully considered. The numerical method is verified by comparing with experimental data and other solutions in the literature. In addition, a parametric analysis of the effects of the incident angle, surrounding rock medium, and aspect ratio on the tunnel is also presented. The results show that with the increase of the incident angle, different parts of the tunnel exhibit obvious nonuniform distribution characteristics, and the bending moment of the sidewall is greater than that of the top slab. When the impedance ratio exceeds 0.26, the influence of surrounding rock characteristics on the dynamics of structure is more obvious; with the increase of the aspect ratio, the peak values of axial force at the top slab increases, whereas it decreases at the sidewall.