Le gratin is a word that has a double meaning. As you may already know, le gratin refers to a dish made of sliced potatoes baked in the oven until the surface gets brown and becomes crusty.
In a more colloquial context, the expression refers to a social elite, an exclusive crowd who distinguish themselves by their social background, their wealth and their elegance. Nowadays, we also use this expression for an up-and-coming artist that can belong to the gratin without being particularly wealthy or of noble origin.
This expression appeared at the end of the 19th century. It plays on the idea that the browned top of the gratin is the most flavorful, like the social elite, dominating the rest of the society.