The Gray Wolf (GWO) algorithm aims to address the path planning problem of multiple UAVs, and the scene setting is mainly to avoid threats, meet the constraints of UAVs themselves and avoid obstacles between UAVs. The scene setting is relatively simple. To address such problems, the problem of time windows is considered in this paper, so that the UAV can arrive at the same time, and the Gray Wolf algorithm is used to optimize the problem. Finally, the experimental results verify that the proposed method can plan a safe flight path in the process of multi-UAV flight and reach the goal point at the same time. The mean error of flight time between UAVs of the GWO is 0.213, which is superior to PSO (0.382), AFO (0.315) and GA (0.825).