Vinegar contains acetic acid. Acetic acid is derived from alcohol, as bacteria in the air turn it from ethanol to acid, though the acid is diluted in commercial vinegar.
Acetic acid is considered a weak acid in chemistry, which means that it does not completely ionize in water. However, at its full strength, it can still cause reactions. Vinegar not only adds flavor to food, it acts as a preservative, since as an acid, it kills bacteria. For instance, the sour taste in hamburger pickles comes from vinegar, but that vinegar is what helps to keep them fresh in the refrigerator over a long period of time.