He was studying at West Virginia University in Morgantown, which is known for its research on auto emissions, when the director of his program asked him to complete a grant application from the International Council on Clean Transportation. The council, a nonprofit group, wanted to test the emissions of German diesel cars sold in America. Mr. Kappanna was pursuing a doctorate, and his proposal helped the university win a modest $70,000 grant.

The university planned a real-time test of emissions, and it rigged up an ingenious way to scrutinize the exhaust generated under open-road conditions. The standard practice was to test cars in specially equipped garages, which is much easier than trying to analyze fumes from a moving vehicle.

Mr. Kappanna and two other graduate students, Marc Besch from Switzerland and Arvind Thiruvengadam from India, were chosen to do the fieldwork. They bolted portable emissions-testing equipment to a sheet of plywood and crammed it into the back of a Volkswagen diesel station wagon.

The rig, powered by a portable gasoline generator, was noisy and smelly, but with every mile, it churned out data that challenged sticker-price assurances. The emissions were dirtier than anyone would have imagined.

Mr. Kappanna and his fellow students did not know it, but they were gathering evidence of a crime. Volkswagen engineers had devised so-called defeat device software that could recognize the standardized procedure used by regulators in their testing labs. In the labs, the software dialed up a car’s pollution controls.

But when officials were not looking or, more important, when the cars were being used by regular motorists, the software dialed down to save wear and tear on the fragile emissions-control equipment. Volkswagen never expected anyone, much less a group of graduate students, to test the cars on the highway, when the defeat device would not work.