In order to solve the problem of accurate vehicle path tracking and address the issues of low convergence accuracy and susceptibility to local optima in Whale Optimization Algorithm (WOA), a nonlinear convergence factor is proposed and nonlinear inertia weights are introduced to improve the basic WOA. Firstly, the convergence factor in WOA is changed to a nonlinear convergence factor, and a nonlinear inertia weight is introduced to improve the convergence accuracy, local development ability, and global search ability. Then, this algorithm is combined with a fifth-degree polynomial. The simulation results show that the proposed method can solve the problem of vehicle path tracking effectively. And also, the vehicle can track the given path controlled by the proposed algorithm with higher accuracy and has stronger applicability. The study can help drivers easily identify safe lane-changing trajectories and area.