The Galerkin method is proposed to reveal the dynamic response of pipe conveying fluid (PCF), with lateral moving supports on both ends of the pipe. Firstly, the dynamic equation is derived by the Newtonian method after calculating the acceleration of the fluid element via the dynamics approach. Secondly, the discrete form of the dynamic equation is formulated by the Galerkin method. Thirdly, the numerical analysis of the system is carried out through the fourth-order Runge–Kutta method, and the effectiveness of the proposed method is validated by comparison with the analytical results obtained by the mode superposition method. In the example analysis, the responses of the lateral deflection and bending moment are investigated for the pinned-pinned, clamped-pinned, and clamped-clamped PCF. The effects of fluid velocity and the moving frequencies of supports are discussed. Especially, the deflection responses are analyzed under extreme condition; i.e., the moving frequency of a support is identical to the natural frequency of PCF.