This paper presents a genetic algorithm-based dynamic routing strategy in wavelength division multiplexing (WDM) optical networks aimed at minimizing blocking probability and optimizing wavelength usage. It discusses the increasing demand for network bandwidth due to various applications and analyzes three network sizes using simulation to evaluate the algorithm's performance. The findings indicate that the proposed approach significantly improves routing efficiency and reduces blocking probability compared to traditional methods.