The only free and comprehensive online etymological dictionary of the Spanish language
gustar (Verb) "to please," "to like;" "to taste"
13th cent. Old Spanish gostar. From Latin gustare "to taste." From gustus "tasting" (see gusto).
Indo-European
Romance
Portuguese gostar, Catalan gustar, French goûter, Italian gustare, Aromanian gustu, Romanian gusta, Sardinian gustare

Over time, the meaning drifted from "to taste" to "pleasing (in taste)" to "pleasing."