Let us first discuss how thunder and lightning is caused?
When two oppositely charged ions – positive and negative charges come in contact with each other, they balance themselves with a flash of light, known as lightning. Basically, a cloud develops protons and it now starts to attract oppositely charged protons from the ground, trees, mountains, sometimes people too. Once an attraction is made, it is represented through a flash of light. Thunder is the rumble of this lightning bolt. It is nothing but the sound of the charges vibrating.
Coming to your question, we see the flash of light much before the sound of thunder. This is due to the variation in speed of light and speed of sound. The speed with which light travels is much higher than the speed with which sound travels. Speed of light in air is 3*10(to the power 8) m/sec whereas speed of sound in air is approximately 334m/sec (depending on the temperature) that is much lower than that of light. Thus we the lightning much before the sound is heard.
I hope this answer helps.