It should be obvious, but it wasn’t to me: the Spanish for “compliment; praise” (elogio) comes from the Latin elogium meaning “inscription; short saying.” The Latin elogium comes from the Greek elegeia, meaning, “elegy” — from which we get that same English word!

This should be clear, since the e‑l-o‑g of elogio maps to the e‑l-e‑g of elegy quite neatly. 

But how did we get from “short saying” to “compliment”? Easy: the short sayings that we used to say about other people, over time — centuries — got nicer and nicer and nicer, until everything turns into a compliment. Who wants to be remembered as the nasty guy insulting everyone, anyway?