Speed is what governs who attacks first. Higher speed means you'll attack first
Some moves like Electro ball do damage based on speed. Electro Ball will deal damage if the user is faster, Gyro ball will deal more damage if the user is slower.
In Gen 1, It also governed a Pokemons critical hit rate. Being fast would mean you were more likely to land a critical hit. This was changed for obvious reasons.