How to shoot a light trail photo where an object is still in focus?

I have come across this picture of a car where the background has a light trail effect but the object (which is the car) is still in focus.

I know how to create the light trail effect but I’m not sure how to keep the foreground in focus. I’m a beginner.

Does anyone know the name of this technique? Was this achieved with just photography or would Photoshop be required?

See example below:
light trail effect with foreground in focus