Temperature is proportional to the kinetic energy of the molecules of a substance. Kinetic energy is the energy of an object due to its motion.
Heat is generated during the process of transferring energy from one body to another. Take note that the direction of transfer is always from hot to cold. (Second law of thermodynamics.) When two objects that are in thermal contact reach the same temperature they reach thermal equilibrium.
There are various types of energies such as rotational energy, translational energy, etc. All of these energies of a specific body combined form the internal energy of that body.
The three laws of thermodynamics are:
1) When heat is added to a system, it is transformed to an equal amount of some other form of energy. In the simplest sense, energy can't be created or destroyed. Rather, it can only be transformed.
2) Heat always flows from hot to cold. (There are other less friendly definitions of the second law.)
3) Absolute Zero temperature cannot be reached (In classical mechanics. In quantum mechanics it can, but you don't need to worry about this yet.) Absolute zero is -273.15°C or 0°K (Kelvin.) The reason it can't be reached is because when a substance is at absolute zero, the atoms of that substance come to a stand still. This is not possible as kinetic molecular theory states that all atoms are perpetually vibrating.
There is another law known as the Zeroth Law which states that if System A is in thermal equilibrium with System B and System B is in thermal equilibrium with System C, then System A is in thermal equilibrium with System C.