To eliminate the effect of ocean currents for optimal path planning for unmanned underwater vehicles (UUVs) in the underwater environment, an intelligent algorithm is designed and proposed in this paper. The algorithm consists of two parts: an artificial potential field-based algorithm that derives the shortest path and avoids collision accidents; and an adjusting function that eliminates the effect of ocean currents. The planning results of the intelligent algorithm are presented in detail, and compared with the conventional algorithm that does not consider the effect of currents. The effectiveness of the optimised path planning method given in this paper is proved.