In the 1970’s and 1980’s there were several books the either had characters that did it or promoted it.
Why is there no cooking tray in my new car’s engine bay?
Is it dangerous? (It would be less physically dangerous if there was a specific spot for it.)
You can run it through a heat exchanger. I mean, if there was enough demand, you could do it. Probably are some aftermarket modifications out there to do it. People definitely have done it before.
I can give a handful of plausible reasons why you wouldn’t want to generally do it, though.
While car engines do produce a lot of waste heat, they normally do so when a car is moving. Your trip length probably isn’t directly tied to the amount of heat you want to cook, or the times you want to cook. And cooking in a moving vehicle is going to either require you to work in sealed containers or deal with sploshing. Like, even in an RV, there’s more to this than just “run heat exchanger off the exhaust, route heat up to oven”.
You can use a car idling to produce heat, but then you’re burning gasoline, not to mention adding some wear-and-tear to your car’s engine, just to get a portion of what you would by taking a container of white gas and cooking on a camp stove.
Depending upon where this goes – and it’s probably gotta be pretty near the car – you’re liable to need to deal with grease spatters or whatever. Do you want to deal with bacon grease or whatever on the car?
I mean, if I were going to cook a little bit with energy coming from a car, my first choice would be something like an Instant Pot insulated pressure cooker running off a lithium ion power station charged off a car’s electrical circuits. That contains the food, is energy-efficient at the cooking stage (IIRC, only microwaves are more energy-efficient than an insulated pressure cooker), lets me move away from the car to cook if I’m camping, and lets you use other sources of power (like solar if you’re in some kind of vehicle off-grid or charge via A/C if you’re at the grid, which is cheaper than gasoline). Most of the time you’re gonna be cooking near a car, I suspect you’d also like to have a source of electricity, so your power station serves multiple duties. If you have an electric car that can provide power while it’s off, then you don’t even need the power station, since you’re already hauling one around.
If I wanted to specifically grill, then there are propane (if you’re in Europe, I understand that this is often commercially available as “LPG”) grills.
I think that most “serious” in-vehicle cooking (food trucks, RVs) use propane.
If you want to cook with something akin to gasoline, there’s Coleman camp stoves. The fuel basically amounts to gasoline without gasoline additives that might be an issue for cooking; I thought that this was “white gas”, but according to the WP page, Coleman fuel has some additives aimed at stoves rather than cars that aren’t in white gas. The fuel will cost more than gasoline; it looks like about 4x, checking online.
EDIT: There are also denatured alcohol camp stoves. The US has a huge amount of non-food-grade ethanol production. Last time I looked, it was about 40% of global capacity. This is a subsidy to corn farmers and mostly gets mixed into gasoline, but I’d guess — without actually comparing prices or how the subsidy gets applied — that it probably also means that if you’re in the US, you probably also effectively get subsidized denatured alcohol fuel, since if nothing else you can leverage economy of scale in the production infrastructure.