explain that energy transfers and transformations in mechanical systems always result in some heat loss to the environment. Like why is it necessary for a heat loss?
This is a hard topic but I'll try to give a brief reply.
"Heat" consists of random motion of atoms vibrating about in all directions at a variety of speeds. A heat engine strives to catch that random motion and turn it into a moving piston or a spinning turbine wheel. A simple measure of how much heat we have in (for example) a sample of hot gas is its temperature, and a perfect capture of heat energy from hot gas by an engine would mean the exhaust of that engine would be at zero temperature.
But the environment surrounding that engine is not at "zero temperature", it is at 270 degrees celsius above zero, which means that the exhaust of the engine will leave it with heat that the engine could not capture. This is one reason why heat engines cannot in principle extract all the heat energy out of a sample of hot gas.
Another reason is that no engine is perfect is that all its bearings and sliding and spinning parts have friction trying to slow them down as they move, and that friction steals work from the engine and turns it into heat which leaves the engine while it is running.
Yet another reason no heat engine is perfect is that it is impossible to completely prevent heat from leaking out through the walls of the engine while it is running. That leakage also contains heat energy that the engine obviously cannot use to do work for us.
If a car with some kinetic energy were to smash into another car, some of the transferred kinetic energy is dissipated as heat. Because everything is made up of atoms and they would vibrate as well. It is the atoms that take up the kinetic energy and redistribute it everywhere. In this case, the atoms do vibrate, and that energy of vibration sums up with every other atom behaving as such, as heat.
It is because any kind of Energy transfer or conversion contain movement,
It does not matter whether its an (electrical, mechanical, light, chemical, gravitational, heat, or sound energy.)
Any type of energy transfer requires the movement of atoms;
for example you want to run a DC motor using electrical energy, the electrical energy source will have the movement of electrons through the wires, and thus the heat in the wires will start to rise the temperature and produce losses, and then when the motor starts to run it will face some resistance and friction in rotating due to the surroundings and the rotor material nature.
So to sum it up, any movement can yield friction, resistance and other draw backs that will end up as a heat loss.
In simpler words you can read this from Wikipedia :
the 11th century AD, Abū Rayhān Bīrūnī cites movement and friction as causes of heat, which in turn produces the element of fire, and a lack of movement as the cause of cold near the geographical poles:
The earth and the water form one globe, surrounded on all sides by air. Then, since much of the air is in contact with the sphere of the moon, it becomes heated in consequence of the movement and friction of the parts in contact. Thus there is produced fire, which surrounds the air, less in amount in the proximity of the poles owing to the slackening of the movement there.
In the 13th century, the Islamic philosopher and theologian ʻAbd Allah Baydawi considered two possibilities for the cause of heat:
a) that [natural heat] would be the heat of a fiery atom that is broken, and b) that heat may occur through motion-change, the proof of this being through experiment.
In 1253, a Latin text entitled Speculum Tripartitum stated:
Avicenna says in his book of heaven and earth, that heat is generated from motion in external things.
Around 1600, the English philosopher and scientist Francis Bacon surmised that:
Heat itself, its essence and quiddity is motion and nothing else.
This echoed the mid-17th-century view of English scientist Robert Hooke, who stated:
Heat being nothing else but a brisk and vehement agitation of the parts of a body
I hope this is helpful.