Burning fossil fuels results in emissions of carbon dioxide (CO2), which significantly contributes to atmospheric changes and climate disturbances. Consequently, people are becoming concerned about the state of the environment, and governments are required to produce precise projections to develop efficient preventive measures. This study makes a significant contribution to the area by modeling and predicting the CO2 emissions of vehicles using advanced artificial intelligence. The model was constructed using the CO2 emission by vehicles dataset from Kaggle, which includes different parameters, namely, vehicle class, engine size (L), cylinder transmission, fuel type, fuel consumption city (L/100 km), fuel consumption hwy (L/100 km), fuel consumption comb (L/100 km), fuel consumption comb (mpg), and CO2 emissions (g/km). To forecast the CO2 emissions produced by vehicles, a deep learning long short-term memory network (LSTM) model and a bidirectional LSTM (BiLSTM) model were developed. Both models are efficient. Throughout the course of the investigation, the researchers employed four statistical assessment metrics: the mean square error (MSE), the root MSE (RMSE), Pearson’s correlation coefficient (R%), and the determination coefficient (R2). Based on the datasets of experiments carried out by Kaggle, the LSTM and BiLSTM models were created and implemented. The data were arbitrarily split into two phases: training, which included 80% of the total data, and testing, which comprised 20% of the total data. The BiLSTM model performed best in terms of accuracy and achieved high prediction values for MSE and RMSE. The BiLSTM model has the greatest attainable (R2 = 93.78). In addition, R% was used to locate a connection between the dataset’s characteristics to ascertain which characteristics had the highest level of association with CO2 emissions. An original strategy for the accurate forecasting of carbon emissions was developed as a result of this work. Consequently, policymakers may use this work as a potentially beneficial decision-support tool to create and execute successful environmental policies.