Mechanical energy is the sum of kinetic energy and potential energy within a system. For systems that only have conservative forces (no non-conservative forces, like friction, to cause energy to be turned into thermal energy), the mechanical energy stays the same. When non-conservative forces are present, mechanical energy tends to decrease. In the case of friction, this is because the mechanical energy was turned into thermal energy (making the system warmer).
The University of Colorado has graciously allowed us to use the following Phet simulation. Explore this simulation to see how gravitational potential energy and kinetic energy go back and forth but keep mechanical energy the same. Notice how mechanical energy can be lost and turned into thermal energy, but the total amount of energy still stays the same: