Ensuring the safety of autonomous vehicles is becoming increasingly important with ongoing technological advancements. In this paper, we suggest a machine learning-based approach for detecting and responding to various abnormal behaviors within the V2X system, a system that mirrors real-world road conditions. Our system, including the RSU, is designed to identify vehicles exhibiting abnormal driving. Abnormal driving can arise from various causes, such as communication delays, sensor errors, navigation system malfunctions, environmental challenges, and cybersecurity threats. We simulated exploring three primary scenarios of abnormal driving: sensor errors, overlapping vehicles, and counterflow driving. The applicability of machine learning algorithms for detecting these anomalies was evaluated. The Minisom algorithm, in particular, demonstrated high accuracy, recall, and precision in identifying sensor errors, vehicle overlaps, and counterflow situations. Notably, changes in the vehicle’s direction and its characteristics proved to be significant indicators in the Basic Safety Messages (BSM). We propose adding a new element called linePosition to BSM Part 2, enhancing our ability to promptly detect and address vehicle abnormalities. This addition underpins the technical capabilities of RSU systems equipped with edge computing, enabling real-time analysis of vehicle data and appropriate responsive measures. In this paper, we emphasize the effectiveness of machine learning in identifying and responding to the abnormal behavior of autonomous vehicles, offering new ways to enhance vehicle safety and facilitate smoother road traffic flow.