Hi,
Swann discusses this at length in his Practical Engllish Usage, sections 422 to 425 (Nouns in Groups) in my edition. It's best if you can read this, or some other good grammar book, as it's hard to summarize all his detailed points. Here are a few of his comments.
The fisrt noun usually refers to a whole class of things.
The first noun usually has an 'object' relationship to the second noun. If you wrote a longer sentence to expres the same idea, it would be the object of a verb or preposition. eg Book case = People put their books in a book case.
The first noun is usually singular.
The structure usually describes well-known things for which a special name is thus useful. eg a 'corner table' in a restaurant but 'the girl in the corner', not 'the corner girl'.
Some use hyphens, some do not.
The first noun can express various meanings, eg what the second is made of, or where it is found, or what it is a part of, or what it is used for, etc.
Best wishes, Clive