Thunder and lightning are not the same phenomenon, though both are caused by the same event. As a cloud equalizes its electric charge with the ground, the current must pass through a column of air. Air is not a perfect conductor of electricity, so some of the energy is lost to heat as the charge travels downward. An observer experiences this visually as lightning and audibly as thunder.
Lightning is the flash that results from the heated air becoming incandescent as the energy passes through it. The air heats up to the point where its atoms are stripped of their electrons, and plasma is created. This plasma glows brightly and is responsible for the flash of lightning.
The plasma glows this way because it is very hot. Hot gases expand rapidly until they have cooled down. The expansion of the heated column of air creates a shock wave that propagates outward in three dimensions from the site of the lightning strike at the speed of sound. This is known as thunder. Close to the site of the strike, thunder is extremely loud and usually has a distinct cracking sound. This high-frequency sound fades rapidly with distance until only a low rumble can be heard a few miles away.