The Latin sounds for “sh” — and similar variations, like “ch” and “ss” — became a “j” sound in Spanish.
Thus, the English sherry is near identical to the Spanish jerez!
These sh/j sounds were often spelt with a “x” in old Spanish; and sherry itself is named after the town it first came from, Xeres, which is near Cordova.