Why does something get hotter when mechanical work is done on it? Suppose you drag a piece of sandpaper along the surface of a wall (let's keep it simple). Here you are doing positive mechanical work on the sandpaper, this makes it gain energy. Friction does negative work on the sandpaper which makes it lose energy. Now, we know that because the sandpaper is in motion it gains some kinetic energy. But how does the sandpaper acquire heat, i.e., why does its temperature increase?
I've heard some people say it's the negative work of friction which makes the sandpaper lose energy, which ultimately transfers some of its thermal energy as heat to the environment. But if it loses thermal shouldn't its temperature actually decrease?
Or is it the other way around? Not all of the mechanical work gets transferred into kinetic energy. Rather some of it actually gets transported into the sandpaper as heat. But then again shouldn’t the negative work of friction make it lose some of that heat to the environment?
How does the temperature of the sandpaper increase when mechanical work is done on it?
 A: In short, heating due to rubbing surfaces has the same roots as Joule heating, which induces a temperature increase in a conductor when drifting electrons interact with solid lattice ions, producing phonons, i.e., quantized sound waves. Thus, in principle, everything that generates sound waves in a body makes it hotter as new vibrational degrees of freedom are introduced into the lattice. Rubbing causes contacting surface impurities to collide, deform and relax again, which in turn produces lattice sound waves. The same explanation goes for sawing, nail forging, etc., and everything that generates pressure waves within the lattice of body atoms.
A: Heat that is generated by mechanical motion arises because of friction, as noted in the other answers given above. Note that it can also be generated on the molecular level by forcing adjacent molecules to "rub against" one another inside a chunk of solid material.
Materials scientists call this internal friction and is the reason why a chunk of solid rubber can be made hot enough to light on fire by flexing it back and forth rapidly enough that it cannot conduct away the frictional heating fast enough to keep its temperature from climbing up.
This is also why you can heat up a piece of soft steel wire by cyclically bending it back and forth, only in this case it is iron atoms being forced to slide back and forth against one another.
A: A good way to model the thermodynamics of a system like this (that involves sliding friction) is to treat the interface between the bodies (the sandpaper and the table) as a separate thermodynamic sub-system.  The interface has no mass, so its change in internal energy is always zero.  The sandpaper is exerting a frictional force in the positive x-direction on the interface through a displacement in the positive x-direction; this does work on the interface equal to W (the force times the displacement).  The table is exerting an equal frictional force in the negative x-direction on the interface, but with no displacement; this does no work. So the net frictional work done on the interface by the combination of sandpaper and table is just the work done by the sandpaper, W.
If we apply the first law of thermodynamics to this interface sub-system, we obtain:
$$\Delta U=0=Q+W$$, or $$Q=-W$$ This means that heat is leaving the interface at a rate equal to the rate at which work is being done by the sandpaper friction on the interface.  Depending on the properties of the sandpaper and table, part of this heat flows into the sandpaper and the remainder flows into the table.  To cause this heat to flow, the interface becomes hotter than the bulk of the sandpaper or table.  So there is a negative temperature gradient on both sides of the interface, with the maximum temperature at the interface.
A: The negative work done by kinetic friction takes the macroscopic kinetic energy of the object it does work on and converts into the microscopic kinetic energy of the molecules of the sandpaper and wall materials, as reflected by an increase in the temperature of the surface of the materials. In effect, the rubbing action between materials increases molecular motion, and thus kinetic energy, of the molecules of the materials.
The temperature increase of the surface of the sandpaper and wall materials is not due to heat. Heat is energy transfer due solely to temperature difference between objects. If the sandpaper and wall are initially at the same temperature there can be no energy transfer in the form of heat. The increase in temperature is due to friction work.
Consider the fact that you can warm the surfaces of your hands by rigorously rubbing them together. The temperature increase of your skin is due to friction work, not heat. On the other hand, if you put your hands in front of fire, they will also warm up. But in this case it is due to radiant heat transfer from the fire to you hands, due to the initial temperature difference between you hands and the fire.
Hope this helps.
A: As your hand pushes the sandpaper there is negative mechanical work done on your hand and positive mechanical work done on the sandpaper. These are (in the ideal case) equal in magnitude so that there is no mechanical energy lost between the sandpaper and the hand.
As the sandpaper pushes on the wall there is negative mechanical work done on the sandpaper but (in the ideal case) no mechanical work done on the wall. As a result there is mechanical energy lost at the region of contact between the sandpaper and the wall.
This mechanical energy is converted into thermal energy at the region of contact between the sandpaper and the wall. In technical terms, it is a heat flux boundary condition or a surface heat flux. That means that it is a region where a certain amount of thermal power is generated and then flows into the material through normal thermodynamic processes. This heat flux increases the temperature of the material right at the region of contact and then conduction carries it to the rest of the sandpaper normally.
It is not the mechanical work done on the sandpaper, but the difference between the mechanical work done by and on the sandpaper that is the source of this heat flux. In other words, a large negative amount of mechanical work is done on the sand paper and no mechanical work is done by the sand paper, and the difference results in a large positive heat flux. And this heat flux then increases the temperature.
A: You need to separate two ideas here, that it sounds like you are getting confused.
Doing work, doesn't imply heating.
(Also, as a corollary, negative and positive work, don't signify gaining or losing heat either.)
In simple terms in physics, doing work means that a force acted through a distance. So yes, moving sandpaper is a kind of work.  But if you dropped an object on the moon, gravity would do work on it, but there would be no friction at all, and no warming or cooling. Similarly, when you're in an accelerating car or plane, the car/plane engine does work, moving you.
But you don't experience friction or warming up because of that work. At most  the outside of the vehicle may warm up, and a tiny part of that might be transmitted to you, but that's not friction, that's usual heat from a warm object. Or your seat compresses microscopically to a fixed amount then is static, and again that's not friction.
In your example, the sandpaper acquires heat because as it presses on the surface, it forms tiny electrical bonds with the surface. As you move it, those bonds have to be broken and then remake, broken and remake, constantly. That's part of why you need to use more force to move the sandpaper (imagine how little force you'd need if it was greased, or made of Teflon). And that constant activity, is also constantly distorting the surface of the sandpaper too, as it "catches" and is torn free, catches and is torn free.
I'm not sure, technically, if its the constant making and breaking/catching and freeing of bonds,  or the resulting constant distortion of the surface, that's actually responsible for the heating effect of friction.
But its one of those two.
A: The following answer is much more detailed re-write from my previous answer, which some people here didn't seem to understand.
This is a difficult question to answer, and none of the answers I've read here actually answer the question.  They try to give the impression that substitution of words is an explanation.
The temperature of a material is directly related to the vibrational energy of the molecules/atoms that make up the material.  The molecules/atoms of solids are held in place by their mutual forces.  But those forces only create a neutral position, with the vibration of interest occurring about that neutral position.  How then does rubbing increase that vibration?
It's my understanding that the frequency of this vibration is fixed by quantum mechanics, well up in the multi-terahertz. and thus rubbing cannot change that frequency.  However, it can change the amplitude, as I'll explain.
With the spring/mass analogy made for these phenomena, changing the amplitude and keeping frequency constant results in higher vibrational velocities, and thus higher temperatures. That's the basic idea, and here are the details.
So how does rubbing change the vibrational amplitude?  Answer: the atoms/molecules of both rubbing and rubbed material either physically contact those of the other material or become so close to the latter that electrostatic forces become large between the particles in both materials.  Further, the displacement of the rubbing material is many orders of magnitude larger than the amplitude of vibration of the particles in both materials.  Thus, whether by direct contact or close enough contact between both materials' particles, the pertinent particles in both materials are forced into displacements that are exceedingly larger than their vibration amplitudes.  In fact, the forced displacement breaks some of the inter-bonds of these materials and their surfaces become worn.
Thus, a vibrating particle that is able to not be too far nudged from its neutral position will snap back to vibrate, but with now a larger amplitude, since the "initial condition" for the new vibration is larger than the amplitude before rubbing. The larger amplitudes of vibration occurring at the contacting surfaces in turn impose larger vibrational amplitudes in nearby particles, and the heating of the bulk material proceeds by diffusion.
It can be easily seen how such a process requires a transfer of energy from the rubber to the rubbed.  It takes energy to increase the amplitude of vibration, in the same way it takes energy to push someone on a swing to higher amplitudes.  The energy levels involved are less for those simply increasing temperatures than for those involved in breaking intermolecular and interatomic bonds, which is what occurs with abrasion, wearing, and sanding.
In the case of a gas, where it's the translational energy that defines temperature (not the internal rotational and vibrational modes) we can consider that rubbing creates a boundary layer, and in the most violent situations, creates also large turbulent eddies.  But the original question regards only solids, so I'll reserve the detailed explanation of this case for a new question.
