Herein, to address the challenges faced by Automatic Guided Vehicles (AGVs) in construction site environments, including heavy vehicle loads, extensive road search areas, and randomly distributed obstacles, this paper presents a hierarchical trajectory planning algorithm that combines coarse planning and precise planning. In the first-level coarse planning, lateral and longitudinal sampling is performed based on road environment constraints. A multi-criteria cost function is designed, taking into account factors such as deviation from the road centerline, shortest path cost, and obstacle collision safety cost. An efficient dynamic programming algorithm is used to obtain the optimal path. Considering nonholonomic constraints of vehicles, eliminating inflection points using improved B-Spline path fitting, and a quadratic programming algorithm is proposed to enhance path smoothness, completing the coarse planning algorithm. In the second-level precise planning, the coarse planning path is used as a reference line, and small-range sampling is conducted based on AGV motion constraints, including lateral displacement and longitudinal velocity. Lateral and longitudinal polynomials are constructed. To address the impact of randomly appearing obstacles on vehicle stability and safety, an evaluation function is designed, considering factors such as jerk and acceleration. The optimal trajectory is determined through collision detection, ensuring both safe obstacle avoidance and AGV smoothness. Experimental results demonstrate the effectiveness of this method in solving the path planning challenges faced by AGVs in construction site environments characterized by heavy vehicle loads, extensive road search areas, and randomly distributed obstacles.