This is a tradition that dates back to the Spanish Inquisition, where the double surname system was used to track family lineages.
The first surname is the father's surname (apellido paterno), and the second is the mother's surname (apellido materno).
For example, if the father's surname is "García" and the mother's surname is "Rodriguez", their child would have the surnames "García Rodriguez".
It's important to note that while two surnames are the norm, sometimes individuals might use only one surname, especially for professional reasons or to shorten their name.