Reciprocating mass (pistons, rods, and valves constantly changing direction) is where a great deal of the energy is sunk when engine braking. It doesn't all go to heat. Accessories are also doing useful work like the alternator charging the battery and the water pump circulating coolant. Friction is significant and increases with rpm and oil pressure, but you aren't heating it nearly as much as when it's burning fuel.
Naw, diesels do all of that too and their engine braking is minimally effective without modifications. Trucks will have "Jake brakes" installed, but diesel cars get minimal effects from engine braking.
Gas vehicles effectively engine brake without modification, but dunno where all the energy is getting converted.
I do wish alternators would detect engine braking and ramp up electric cabin heat though.
Oh yeah, diesels suck air all the time whereas gas engines are creating a strong vacuum, which is a lot of effort. They turn at higher rpm than diesels, too.