Aiming at the path planning requirements of UUV to achieve the optimal global path and dynamic obstacle avoidance in real-time environment in underwater environment, the DWA algorithm used in traditional land robot path planning research is improved to meet the corresponding conditions of underwater environment. The influence of ocean current and weight factor is introduced to optimize the heuristic function, so as to improve the evaluation function in the traditional DWA(Dynamic Window Approach) algorithm and improve its search efficiency in a specific environment. Experiments show that in dynamic situations, the proposed UDWA(Underwater Dynamic Window Approach) algorithm can significantly improve the efficiency of UUVs underwater, flexibly avoid obstacles, and have excellent path planning effects.