It is a transfer of the meaning on the basis of contiguity. There are different types of metonymy:
a) the material of which an object is made may become the name of the object , e.g. a glass, boards, iron etc;
b) the name of the place may become the name of the people or of an object placed there, e.g. the House - members of Parliament, Fleet Street - bourgeois press, the White House - the Administration of the USA etc;
c) names of musical instruments may become names of musicians, e.g. the violin, the saxophone;
d) the name of some person may becom a common noun, e.g. «boycott» was originally the name of an Irish family who were so much disliked by their neighbours that they did not mix with them, «sandwich» was named after Lord Sandwich who was a gambler. He did not want to interrupt his game and had his food brought to him while he was playing cards between two slices of bread not to soil his fingers.
e) names of inventors very often become terms to denote things they invented, e.g. «watt» , «om», «rentgen» etc
f) some geographical names can also become common nouns through metonymy, e.g. holland (linen fabrics), Brussels (a special kind of carpets) , china (porcelain) , astrachan ( a sheep fur) etc.