In gaming, a scrim is a test match between two e-sports teams. Scrim is short for "scrimmage". Scrimmages are very common in other sports such as soccer or football in various forms and were therefore simply adopted into gaming. In e-sports, a scrim is most similar to a test match in soccer, for example before a World Cup or the start of the season.
The advantage of a scrim in gaming is that professional teams can go toe-to-toe or test individual things without losing face or ranking. After all, nothing is at stake and the only purpose of the match is to get better.
The most common occasion for scrims is upcoming tournaments, seasons, or ranked matchups. Most of the time, scrimming follows the same rules that you have to play under in the tournament or league. These rules can be about weapons, heroes, essays or skills, for example.
A big advantage of scrims is that the teams are usually on the same or a very similar skill level. It often doesn't matter that you meet later in a tournament or the league, because the advantages of duels on eye level outweigh the disadvantages. The match making of the games is simply not enough for professional players. If a professional team decides to play public matches together, the training effect is limited in most cases.
But there are other advantages, such as better assessment of opposing teams, finding one's own weaknesses, training communication, or specific training of individual elements/tactics against the best possible competition. Because it is something completely different, if you push objects and hold areas against a thrown together team, or against one of the top 10 teams in the world.
Scrims are most common in first-person shooters, but they are also very common in games like LOL or Rocket League. Basically, you can say that scrims in gaming become more common the more professional a game is played.