In Metonymy an object is designated by the name of something which is generally associated with it. Generally, Metonymy a change of name, as the name suggests in this figure of speech there is a literal change in the name of the object. This helps writers or poets to convey their message or express their thought through words which are closely related.
Eg: Hollywood (association with movie industry; The bench (Judges)