The strongest indication that someone is in their car is if their iPhone is connected to a a car Bluetooth network. But since not everybody has Bluetooth in their car, Apple uses other signs that you might be driving.
The driving mode uses a number of signals, such as the iPhone's accelerometer, the rate at which it finds and loses nearby Wi-Fi networks, and GPS to try to detect when it thinks you are driving.
Because it is turned on by default and is activated automatically, it may affect public transport users and passengers. The feature is likely to get more accurate over time as Apple gets more data about who is and is not driving.