This study explored the use of Artificial Intelligence and Machine Learning techniques for intrusion detection in network security. Four benchmark datasets — NSL-KDD, UNSW-NB15, CICIDS2017, and ToN_IoT — were used to analyze and compare the performance of different machine learning and deep learning models. Models such as Random Forest, Lo-gistic Regression, SVM, k-NN, Decision Tree, MLP, and LSTM were trained for both binary and multiclass classification tasks. Results showed high accuracy in binary attack detection, especially with Random Forest and LSTM models, while multiclass classification faced chal-lenges due to class imbalance and rare attack types. The study concluded that AI-based IDS systems are effective for network security, and that feature engineering, dimensionality re-duction, and hybrid learning methods can further improve detection performance and effi-ciency.