Though it is theoretically possible to hear thunder and then see lightning, lightning actually causes thunder, so it has to come first. Thunder is the noise that's caused by the sound of the rapid expansion of air that gets suddenly heated by a bolt of lightning.
Lightning is extremely hot, and it can reach temperatures as high as 54,000 degrees Fahrenheit. When lightning hits the air, there's a huge temperature difference, and the air around the lightning bolt heats up very quickly as a result. The heat causes the air to essentially explode because it expands so quickly, which causes the loud cracking noise that starts a roll of thunder. The rumbling noise that follows the crack is a result of vibrations in the air column.
The speed of light travels much faster than the speed of sound, so people should see lightning before they see thunder. If someone hears a clap of thunder before they see a flash of lightning, the thunder they are hearing is the result of a different bolt that the person didn't notice. Because lightning occurs before thunder, lightning that is followed directly by the sound of thunder is a good indicator that a storm is quite close.