This paper presents a terahertz (THz) gas sensor based on a planar structure consisting of three cascaded spiral resonators incorporating graphene, black phosphorus (BP), and vanadium dioxide (VO \(_2\) ). The integration of these advanced two-dimensional materials enhances both sensitivity and adaptability for gas detection. The Wave Concept Iterative Process method is employed to model the interactions with various gases, and a novel implementation enables extensive simulations that exhibit excellent agreement with theoretical predictions. To further optimize performance, a machine learning model is developed to predict sensitivity based on key material parameters, including the conductivities of graphene, BP, and VO \(_2\) . The model achieves its highest predictive accuracy for ammonia (NH \(_3\) ), with an R \(^2\) of 0.991, a mean absolute error of 0.008, and a mean squared error of 0.00020 using an 80% training set. The proposed sensor exhibits sensitivities of 2.256, 2.371, 2.462, 2.413, and 2.391 THz/RIU for CH \(_4\) , N \(_2\) O, NH \(_3\) , CO \(_2\) , and H \(_2\) S, respectively. Compared to existing designs, it offers superior sensitivity, room-temperature operation, and rapid response, thereby advancing THz gas sensing technology and enabling highly sensitive and adaptable detection for practical applications.