die Gunst
favor
Goodwill, a positive attitude, or preference that someone shows toward another person.
Durch seine Zuverlässigkeit erwarb er sich die Gunst seines Chefs.
Through his reliability, he gained the favor of his boss.

favor
Loading your saved state.
favor
Goodwill, a positive attitude, or preference that someone shows toward another person.
Durch seine Zuverlässigkeit erwarb er sich die Gunst seines Chefs.
Through his reliability, he gained the favor of his boss.

'Die Gunst' (favor) belongs to the word family of 'günstig' (favorable/advantageous) and 'gönnen' (to grant someone something positive / not begrudge someone something). All of these words have the basic positive meaning of advantage or goodwill.
Das Wetter ist heute günstig für eine Wanderung.
The weather is favorable today for a hike.
The idiom 'die Gunst der Stunde nutzen' is very common. It means to seize a good opportunity immediately.
Er nutzte die Gunst der Stunde, um nach einer Gehaltserhöhung zu fragen.
He seized the opportunity to ask for a raise.
The phrase 'zu jemandes Gunsten' means 'to someone's advantage' or 'in someone's favor'. It is always formed with the genitive: 'zu meinen Gunsten' (in my favor), 'zu Gunsten des Angeklagten' (in favor of the defendant).
Die Entscheidung fiel zu Gunsten der Umwelt aus.
The decision was made in favor of the environment.
You can 'werben' (court/seek) or 'buhlen' (compete for) someone's 'Gunst' (favor). If you are successful, you 'steht man in jemandes Gunst' (are in someone's favor) or have 'erworben' (earned/acquired) their favor.
Der junge Künstler warb um die Gunst des reichen Mäzens.
The young artist sought the favor of the wealthy patron.
'Gunst' (favor) is a word of elevated style. You find it more often in historical novels, official contexts, or written language than in everyday conversation.
Der Minister verlor die Gunst des Kanzlers.
The minister lost the favor of the chancellor.
advantage
'der Vorteil' and 'die Gunst' can both have to do with a benefit for someone. 'Der Vorteil' is the normal word when something helps someone or gives them a better position. In this meaning, 'die Gunst' is used mainly in fixed expressions like 'zu jemandes Gunsten' (in someone's favor). This then means: to that person's advantage. The words can be confused because 'zu meinen Gunsten' means something similar to 'zu meinem Vorteil' (to my advantage). On its own, however, 'Gunst' often sounds more like goodwill or approval, not simply a practical advantage.

Das Gericht entschied zu ihren Gunsten.
The court ruled in her favor.
Bei der Arbeit war es heute ein Vorteil, dass er den Kunden schon kannte.
At work today, it was an advantage that he already knew the customer.