In accordance with the emission regulations specified in GB17691-2018 ″Emission Limits and Measurement Methods for Heavy-Duty Vehicles (China VI)," this paper conducted actual on-road emission testing of a specific N2 heavy-duty diesel vehicle using a vehicle-mounted portable emission measurement system (PEMS). Grey relational analysis and principal component analysis were employed to select input parameters and reduce the dimensionality of input parameters, thereby enhancing the quality of the input parameters. The main framework of the model utilized a Gated Recurrent Unit (GRU) neural network characterized by a small scale, high accuracy, and good generalization capability. Innovatively, a combination optimization algorithm incorporating Bayesian algorithm and k-fold cross-validation was used to optimize hyperparameters, improving the predictive accuracy of the model. The training process employed a learning rate adjustment strategy that combined cosine annealing and exponential decay, thereby improving the search performance during the neural network training process. The resulting BO-GRU network exhibited a root mean square error (RMSE) of 1.2352 (mg s−1) and a coefficient of determination (R2) of 0.9569 on the test set, indicating good predictive accuracy with a relatively small number of network parameters. This research provides a potential approach for the online precise monitoring of NOx emissions from heavy-duty diesel vehicles.