The invention provides an optimal time trajectory planning method for a mechanical arm. According to the method, under the condition that multiple constraint conditions such as the speed, the acceleration and the jump value of the mechanical arm are considered, the inertia weight and the learning factor in a particle swarm are improved, and the defect that the particle swarm is prone to convergence, so that a local optimal solution is obtained is overcome. Meanwhile, a 3-5-3 polynomial interpolation trajectory method is adopted, so that the algorithm is simple in structure, parameters are easy to adjust, and the defects that the polynomial is high in order, has no convex hull property and the like are overcome. According to the optimal time trajectory planning method, the particle swarm optimization is improved, so that the operation time of the mechanical arm is shortened, and smooth and stable joint position, speed and acceleration curves are obtained.