By using quintic polynomial function to interpolate several given points of each joint of the robot, the mathematical expressions of each joint variable of the robot with time are established. In addition, to improve the search algorithm performance crossover operator and mutation operator of the genetic algorithm are improved in cosine form. Furthermore, the improved adaptive genetic algorithm is applied to optimize the time interval of interpolation points of each joint, so as to realize time optimal trajectory planning. Moreover, MATLAB simulation is carried out, and the results show that the method proposed in this paper reduces the running time of the robot tasks. Meanwhile, the curves of angle position, velocity and acceleration of each joint are smooth enough, which ensure accomplish its tasks in a stable and efficient way.