Lane-changing is a basic driving behaviour, which largely impacts on traffic safety and efficiency. With the development of technology, the automated lane-changing system has attracted extensive attention. Among it, the trajectory planning part is a challenging problem owing to the complexity and diversity of the driving situations. The planner requires the real-time capability to produce safe and comfortable trajectories for coping with the dynamically changing environment. Based on this, the paper proposes a lane-changing trajectory planning model in dynamic driving environments. The model constructs a neural network to predict the end position of the ego vehicle, and then adopts the mathematical programming method to solve the optimal lane-changing trajectory that guarantees the ride safety and comfort. With the assistance of the neural network, the lane-changing trajectory planning problem is converted into a quadratic programming (QP) model, thereby achieving rapid solution of the model. Moreover, to train the proposed algorithm, a novel approach for generating the scenario data is designed, which can generate rich and diverse traffic scenarios at a low cost. The simulation results show that the proposed model can plan a lane-changing trajectory quickly and effectively, and the ego vehicle can follow the planned trajectory safely and comfortably.