Thermoelectric coolers work based on a phenomenon called the Peltier effect. When two different metals are attached together and a current is run between them, heat is drawn out of one metal into the other. In a thermoelectric cooler, there is usually a whole series of small metal cubes called a thermopile. The cool end is inside the cooler, where it keeps the food cold. The hot end is outside, where it disperses heat into the air.
The Peltier Effect
Spreading the Cold
Metals are good conductors of heat, and heat naturally flows from a hotter place to a colder place. This tendency works against the thermoelectric cooler. As the Peltier effect sucks the heat to one end, the conductivity of the metal tries to draw the heat back toward the cool end. That is why each end is attached to a heat sink. The heat sink on the outside has metal fins, to help conduct waste heat off into the air. Sometimes it also has a fan blowing air onto it to help cool it faster. The heat sink inside helps to cool the food, sucking heat out of it and conducting it into the thermopile.
Thermoelectric cooling is not very efficient. It is often only about 10 percent efficient, compared to normal refrigeration, which is in the 40 to 60 percent range. Normal refrigeration isn't practical for a cooler, since it is heavy, bulky and overpowered. But the thermoelectric cooler doesn't have to do that much. The refrigerator is insulated, so not much heat leaks in. It is also quite small, so it takes much less energy to cool than a refrigerator.