As the key component of a five-axis CNC planer-type milling machine, the integral mechanical property of the A/C swing angle milling head directly affects the machining accuracy and stability of the milling machine. Taking the mechanical A/C swing-angle milling head of a five-axis numerical-control gantry milling machine as the research object, the stress deformation characteristics and natural frequency of the swing-angle milling head under actual working conditions were studied using finite-element analysis. Based on the analytical results, it was determined that the cardan frame, with its large mass proportion and strong rigidity of the whole milling head, is the object to be optimized. The topological optimization of the cardan frame, in which achieving the minimum flexibility was the optimization objective, was carried out to determine the quality reduction area. By comparing the simulation results of the cardan frames of three different rib plate structures, it was shown that the cardan frame performance of the ten-type rib plate structure was optimal. The analytical results showed that, when the cardan frame met the design requirements for stiffness and strength, the mass after optimization was reduced by 13.67% compared with the mass before optimization, the first-order natural frequency was increased by 7.9%, and the maximum response amplitude was reduced in all directions to avoid resonance, which was beneficial to the improvement of the dynamic characteristics of the whole machine. At the same time, the rationality and effectiveness of the lightweight design method of the cardan frame were verified, which has strong engineering practicality. The research results provide an important theoretical basis for the optimization of other machine tool gimbals and have important practical significance and application value.