The escalating sophistication of cyber threats demands adaptive and intelligent defense mechanisms beyond static routing and fixed firewall configurations. This paper presents SmartRoute-FW, an Artificial Intelligence (AI)–based dynamic routing and firewall framework that provides real-time protection through automated learning and decision- making. The system leverages machine-learning algorithms to monitor network conditions, predict anomalies, and proactively mitigate risks. SmartRoute-FW dynamically adjusts routing paths according to congestion, bandwidth, and threat levels, while simultaneously optimizing firewall rules through AI-based policy updates. Experimental evaluations demonstrate significant improvements in detection accuracy, lower false-positive rates, and enhanced network throughput when compared with conventional techniques. The results establish SmartRoute-FW as an adaptive, scalable, and self-learning security model suitable for modern enterprise and cloud environments.