The method of choosing the participants varies a bit from year to year.
Here's how it works in 2020:
1) the runner-up in the 2018 World Chess Championship - Fabiano Caruana.
2) the top two finishers in the 2019 Chess World Cup - Teimour Radjabov, Ding Liren.
3) the top finisher in the 2019 FIDE Grand Swiss Tournament - Wang Hao.
4) the top two finishers in the 2019 FIDE Grand Prix - Alexander Grischuk, Ian Nepomniachtchi.
5) Highest average rating in 2019 - Anish Giri.
6) one wild card pick chosen by the event organizers. This player must have participated in at least two of the three qualifying tournaments (World Cup, Grand Swiss and Grand Prix) and also must have met one of the following conditions: highest non-qualifier in the World Cup and also in the final 4 of the World Cup; highest non-qualifier in the Grand Swiss or Grand Prix; or in the top 10 by average rating from February 2019 to January 2020. - Kirill Alekseenko.
If someone qualifies for more than one spot, then the extra spot is taken by the next player in line. Example: Spot #5, the "Highest Rating" qualifier, is of course the highest rated player who did NOT qualify for spots #1 to #4.
I wonder how the candidate players are chosen to play against carlsen.