The infinitive ‘to win’ implies chance or competition playing an important part in gaining a prize or position.
The infinitive ‘to earn’ implies that something has been done, perhaps a service performed, behavioural pattern or work carried out, in order to receive an entitlement to something e.g. a position, money or trust.