Sherry wine is a wine. You can drink it or cook with it.
Sherry vinegar is a vinegar. You can't drink it (unless you like to drink vinegar) but you can use it as you would any vinegar.
Wine "spoils". When it spoils, it turns into vinegar. In a similar way, you can drink apple cider but when it spoils, it turns into apple cider vinegar.
There are also champagne vinegars, red wine vinegars, white wine vinegars - etc.