The villain of all machines is friction. Even with the best lubricants, there still exists some friction between moving parts in any machine. This transforms some of the energy into heat, and thus prevents it from being used to achieve the purpose of the machine.
Some machines are also plagued by using an inefficient process to transform energies. The internal combustion engine, for example, transforms the Chemical Potential energy in fuels, into kinetic energy. However, burning the fuels transforms the energy into heat, and the engine captures less than 30% of this and transforms it into kinetic energy. The rest goes to waste.