Owing to the rapid economic growth, the importance of the shipping industry has gained prominence. Navigation safety may be prone to hidden dangers if ship collision avoidance measures only depend on the decisions of the crew, especially since ship density has increased sharply and ship routes have become more complicated. The real-time path planning of collision avoidance requires more efficient algorithms, the carbon emission constraint is added in the model to limit the sudden speed change of the ship in each trajectory segments, and the path planned by the algorithm is smoother, which can reduce the probability of dangerous accidents. The ship collision avoidance path planning problem with carbon emission constraint is considered in this study, and a nonlinear programming model is established to minimize the mileage and carbon emission in the process of collision avoidance. A modified potential field ant colony algorithm is proposed to solve the model, in which the ant colony algorithm is combined with the modified artificial potential field method for real-time dynamic avoidance. The main idea is to use the potential field to guide the ant colony in the early iterations, and optimize the design of partial components to improve the convergence speed and global optimization of the algorithm. Finally, simulation results show that the modified potential field ant colony algorithm proposed in this study can help improve the accuracy of route prediction and anti-collision, and solve the ship collision avoidance path planning problem effectively based on automatic identification system (AIS) data.