In this study investigates the effectiveness of combining interleukin-2 (IL-2) with highly-active antiretroviral therapy (HAART) in the control of HIV replication. A mathematical model of the immune system was developed to examine the dynamics of immune recovery when IL-2 is administered alongside HAART. Analytical methods, including direction and stability of Hopf bifurcation analysis, were employed to assess the stability of the endemic equilibrium, and comprehensive numerical simulations were conducted to validate the theoretical results. Central manifold theory is applied to established the direction and stability of Hopf bifurcation periodic solution. From this study we find subcritical Hopf bifurcation in the system. The findings from the optimal control problem indicate that optimal therapy involving IL-2 and HAART enhances treatment efficacy, reduces adverse side effects, and improves cost-effectiveness. This research contributes to a deeper understanding of the role of IL-2 in HIV treatment and highlights its potential in advancing therapeutic strategies.