To address the large hysteresis and susceptibility to instability in high-speed deposition fusion moulding (FDM) 3D printing’s temperature control, this paper proposes an improved ant-lion optimization algorithm (OCALO) to optimize the PID parameters.The improvement aims to solve the problem that the traditional ant-lion optimization algorithm (ALO) reduces the population diversity and tends to fall into the local optimal solution when it is close to the global optimal solution.The generation of the initial solution is enhanced by the introduction of a new Tent-Logistic-Cotangent composite chaotic mapping. This integration into Elite Opposition-Based Learning aids in optimizing population diversity. Concurrently, the incorporation of cosine factors of a specified parameter into the elitist formula of the traditional ALO algorithm is aimed at reducing the tendency of ants to randomly gravitate towards ant-lions with lower fitness values. This adjustment helps in balancing the exploration-exploitation trade-off in the algorithmic process. Compared with two existing classical algorithms and three improved ALO algorithms, the algorithm improves the convergence speed, global search ability and the ability to jump out of the local optimal solution. The improved algorithm was combined with PID control to design an OCALO-PID temperature controller and simulated on a high-speed 3D printing temperature model identified by modelling. The results show that the method improves the transient and steady-state performance of reactor temperature control with good control accuracy and robustness. Finally, the proposed algorithm is applied to a physical experimental platform to verify the feasibility of the algorithm.