Developing effective strategies to contain the spread of infectious diseases, particularly in the case of rapidly evolving outbreaks like COVID-19, remains a pressing challenge. The Susceptible-Infected-Recovery (SIR) model, a fundamental tool in epidemiology, offers insights into disease dynamics. The SIR system exhibits complex nonlinear relationships between the input variables (e.g., population, infection rate, recovery rate) and the output variables (e.g., the number of infected individuals over time). We employ Recurrent Neural Networks (RNNs) to model the SIR system due to their ability to capture sequential dependencies and handle time-series data effectively. RNNs, with their ability to model nonlinear functions, can capture these intricate relationships, enabling accurate predictions and understanding of the dynamics of the system. Additionally, we apply the Pontryagin Minimum Principle (PMP) based different control strategies to formulate an optimal control approach aimed at maximizing the recovery rate while minimizing the number of affected individuals and achieving a balance between minimizing costs and satisfying constraints. This can include optimizing vaccination strategies, quarantine measures, treatment allocation, and resource allocation. The findings of this research indicate that the proposed modeling and control approach shows potential for a comprehensive analysis of viral spread, providing valuable insights and strategies for disease management on a global level. By integrating epidemiological modeling with intelligent control techniques, we contribute to the ongoing efforts aimed at combating infectious diseases on a larger scale.