To play Gran Turismo 7 online, you first have to unlock the Sport and Multiplayer Pavilions on the World Map. To unlock them, you have to complete Menu Book 9, which takes a while, but GT7 really loves to drip-feed its content. Completion of Menu Book 9 unlocks three different multiplayer modes: Sport, Multiplayer Lobby, and 2P Split Screen. The first two are online.
Multiplayer Lobby is a more social, traditional multiplayer mode in which you can either create your own room, or join one created by someone else. There are a lot of different parameters to choose from when creating a room, or filtering for one to join: room mode, race type, region, track, PP limit, car category, and whether or not BoP/Tuning, regular Tuning, and Auto-Drive are allowed. This is the best place to race other players in exactly the conditions you prefer, but results are inconsequential — there are no rankings or leaderboards in Multiplayer Lobby mode.
More competitive GT7 players should play Sport mode. This is a ranked mode with a lot of strict regulations and rules, by which the game does its best to ensure that only the most skilled drivers rise to the top. Instead of traditional rooms and lobbies, Sport mode is structured into races and Championships with scheduled start times. Sport Mode tracks not only your race results, but also your sportsmanship. You’re racing to improve your Driver Rating (DR), but this can’t go up unless your Sportsmanship Rating (SR) is also good. So, in Sport mode, ramming other players is strictly punished.
For the absolute most competitive (and sportsmanlike) GT7 drivers, there are Leagues, which run for the duration of seasons. Some, but not all, Sport mode championships affect League rankings.