"I didn't know you spoke Spanish, but where did you learn it?"
Here's a breakdown of the sentence:
* No sabía: I didn't know
* que tú hablas español: that you speak Spanish
* pero: but
* dónde lo has aprendido: where did you learn it
The sentence expresses surprise that the person being addressed speaks Spanish, and then asks for more information about how they learned the language.