Smart cities integrate advanced technologies to enhance urban living, but they also introduce severe cybersecurity challenges due to interconnected systems and large-scale data flows. Conventional security models are often inadequate in identifying multistep and evolving attacks, leading to high false alarms and compromised resilience. To address these issues, advanced artificial intelligence (AI) and machine learning (ML) solutions are increasingly being employed to secure smart environments. This research introduces the Cybersecurity using Crested Porcupine Optimizer Algorithm with Hybrid Deep Learning Models (CCPOA-HDLM), a novel approach designed to enhance detection, classification, and defense capabilities in smart city networks. Cybersecurity Challenges in Smart Cities Smart cities rely on interconnected infrastructures, including transportation, healthcare, energy grids, and communication systems. These networks are highly vulnerable to cyber threats such as intrusion,...