The rapid adoption of Smart Cities (SCs) has increased reliance on AI-based IoT technologies to enhance smart infrastructure and services, contributing to the UN's sustainable development goals. However, this integration brings significant cybersecurity (CS) challenges, such as DDoS, MITM, phishing, and ransomware attacks. This chapter underscores the importance of CS in SCs, highlighting vulnerabilities and risks. It examines IoT's role in SC infrastructure and services, AI's impact on SC efficiency, and various AI techniques used in SC applications. The chapter analyzes cyberattacks on SC infrastructure, suggesting CS measures like protocols, encryption, authentication techniques, access control, and incident response. AI and IoT integration enhances CS, reducing cyber threats through anomaly detection and real-time data collection for AI-based security solutions. The chapter also presents SC application case studies demonstrating the integration's effectiveness and best practices. It concludes by emphasizing the need for continued research and innovation in SC cybersecurity.