As an electric motor spins, the energy from the electricity is 'conducted' to the rotor by the magnetic fields. However, when the motor is stopped, the energy becomes heat and burns up to motor. What causes this heat to be formed? Is it purely generated by the current flowing through the wire or is the magnetic field form the permanent magnets involved somehow? Conversely, why is there less heat when the motor is spinning? I'm hoping this is not just because the motor contains a fan.
When a motor is turning it acts as a generator and produces a back EMF that opposes the applied EMF. See my answer to Top angular speed of electric motor for more on this. A frictionless motor would draw no current when not under load, though obviously real motors do draw some current because of frictional losses.
If you load the motor you reduce the back EMF, and because the applied EMF is now greater than the back EMF there is an increased current through the motor.
If you stall the motor completely then it does not generate any back EMF at all, so the applied EMF sends the maximum possible current through the motor, limited only by the resistance of the coil windings. Depending on the motor design this may be high enough to damage the motor.
John Rennie's answer is correct for a DC series connected motor and, almost certainly, this is the kind of motor you (the OP) are talking about.
An interesting way of writing John's answer "backwards" is that you have just observed the reason why the most powerful traction motors are exactly this kind of motor - almost all DC train and tram motors are this kind. The current flow, and therefore the developed torque, is maximum when the motor is stalled - this is exactly what you want when you need to get a heavy load like a train going. As the train picks up speed, the back EMF as discussed in John's answer naturally regulates the torque. Have you ever wondered why trains don't have gears? This is why: the torque versus speed relationship that arises from the interaction of speed, back EMF and current is optimally matched for shifting heavy loads. In contrast, an internal combustion engine has very low torque at low speeds and only reaches its peak torque at quite high speeds. So you need a gearing system to let the engine run quickly to get your car moving.
Another, slightly different (from the standpoint of your question) is the AC induction motor. Here a three phased supply sets up a magnetic field that spins (i.e. it looks like the field you'd get from a dipole if you span it about an axis at right angles to the line joining the north and south poles) at the AC line frequency. The motor's rotor is a "cage" like arrangement of conductors normal to the magnetic field lines: if the rotor is not spinning at the magnetic field's angular speed, an EMF is induced by Faraday's law around the loops in the cage and there is a torque that tends to make the rotor accelerate (or decelerate) so that its angular speed matches that of the magnetic field. Such a motor will develop very high currents when stalled too, but the effect is not as dramatic as a DC motor, because the AC winding system has inductance which limits the current. Thus AC induction motors don't tend to be used for traction but rather near-constant speed applications.
i am motor barning..... Note that this depends on the type of motor. DC Electrostatic motors work backwards to coil-based motors. When stalled, the electrostatic motor current drops to zero and the motor would stay cold, but when operated with zero mechanical load, the motor speed and the current will increase until limited by friction or the motor is destroyed by overspeed effects.