physics
:p
Mechanical energy is commonly referred to as "the ability to do work." This is a somewhat inaccurate (though still useful) idea of it, as I'll describe.
Mechanical energy is the sum of kinetic energy (energy associated with motion) and potential energy (energy associated with position). Technically speaking, heat energy (the most common example of non-mechanical energy) is small-scale kinetic energy, but for macroscopic systems, this energy is not mechanical. Although it has the ability to do work, it is small-scale and thus not considered "mechanical."
As far as how mechanical energy is transformed into nonmechanical energy, let me provide a couple of examples:
One is the classic example of friction. When two surfaces rub together, they generate thermal energy, or heat. This is a transformation of the mechanical kinetic energy of the objects into the thermal non-mechanical energy (which is small-scale kinetic energy). This is the primary reason why there are no perfect machines--some energy is always lost as heat due to friction.
Another example is a small electric generator. Rotating a small circuit in a magnetic field will induce a voltage and generate electrical non-mechanical energy. This is a transformation of the kinetic energy associated with the rotation into electrical energy.
The primary difference between mechanical energy and non-mechanical energy is the scope. Mechanical energy is generally associated with macroscopic objects (like water wheels), while non-mechanical energy is generally on the sub-microscopic scale (the kinetic energy of individual atoms). Both can do work, though working with mechanical energy is generally more helpful than trying to work with non-mechanical energy.