All vehicles have a pool of engines that can be bought and installed onto the car.
The number of available engines for each vehicle is generally around 7-10, but a few of the more extreme cars available in the game have limited amounts of available engines.
The available engines for each car have been selected in order to give a variety of sounds while having limits on sizes and performance in order to keep the end-game performance between vehicles more balanced.
So while there are some limitations on what can be done, there are still a lot of options! You can, for example, equip a 2.5 liter Flat 4 Turbo into a Volkswagen Beetle or an 8.4 liter V8 into a Mercedes-AMG GT. Why not install a 4.0 liter V8 into a BMW M3 E46? You can do that, too!