An ID identifies exactly one DOM element, uniquely. A class identifies a group of related DOM elements.
For example, you might have a single, unique nav menu, identified by an ID:
...
and within it have a number of menu sets, each of which is also uniquely identified and which belongs to a common class: