It was not invented as part of anything, but as an engine in its own right for powering other machinery - including though not solely nor at first, cars.
The steam engine
gasoline
It was the invention and development of the internal combustion engine, fuelled by petrol or diesel.
motor vehicles, among other things
aircraft, as steam engine power/weight too low
The Internal combustion engine
The Internal combustion engine
The Internal combustion engine
a gasoline engine is an Internal combustion engine
The internal combustion gasoline engine.
The first device that could be called a prototype of the internal combustion engine was invented in the fifth century, in the form of Roman machines used in sawmills. In the seventeenth century, this idea was expanded upon with the addition of gunpowder as a power source. Internal combustion engine development accelerated in the late 19th century, and they were widespread by the 1900s.
Internal combustion engine.