A student asked me to explain which is better: 'a prime example' or 'a primary example'.
I would say 'a prime example'. Why? Both 'prime' and 'primary' can mean 'main' or 'important', and there is no grammar rule to explain which one is best.
Native speakers instinctively know which words go together more commonly. They recognise groups of words like 'prime example'. This is what we mean by "collocation".
Put "prime example" and "primary example" into Google (don't forget the speech marks), and look at the numbers of results. It should be clear which collocation we prefer.