The obvious way is mounting a camera on a real car like this
However that’s not what filmmakers often use. Instead they tow the car with another vehicle called process trailer
If you shoot from the front or side of the car you’ll see the 2 people talking. But the driver is not really driving the car, just moving the steering wheel in imagination. Some examples
Another common technique is using chromakey and merge the moving scene later in postproduction like this
In the old days with limited processing ability, sometimes they use a projector is used to put the moving scenes outside the car instead of a green screen like this.
If a broader scene is required then the only solution is another moving vehicle for filming