The flash of a lightning strike and resulting thunder occur at roughly the same time. But light travels at 186,000 miles in a second, almost a million times the speed of sound. Sound travels at the slower speed of one-fifth of a mile in the same time. So the flash of lightning is seen before thunder is heard.
Lightning causes thunder because a strike of lightning is incredibly hot.
A typical bolt of lightning can immediately heat the air to between 15,000 to 60,000 degrees Fahrenheit. A lightning strike can heat the air in a fraction of a second. When air is heated that quickly, it expands violently and then contracts, like an explosion that happens in the blink of an eye. It's that explosion of air that creates sound waves, which we hear and call thunder . When lightning strikes very close by, we hear the thunder as a loud and short bang.