The heat from the Lightning strike raises the temperature of the surrounding air. The heated air is compressed, raising the atmospheric pressure. The compressed air explodes outward forming a shock wave of compressed particles in every direction. Like an explosion, the rapidly expanding waves of compressed air create the booming sound of thunder.
To judge how close lightning is, count the seconds between the flash and the thunder. Each second represents about 300m