The whole thing started because the EPA reported that the software that controlled fuel injection on diesel engines was intentionally programmed to detect if the car was running in special lab conditions. It's on the first paragraph of the wikipedia page[0].
[0]: https://en.wikipedia.org/wiki/Volkswagen_emissions_scandal