The short answer is that they do it to gain a competitive advantage. It can be done by slowing down the game, distracting defenders, or drawing fouls in their favor.
Oftentimes players flop or fake injuries to trick the referee into believing they have been fouled and thus deserve a penalty or free kick. This allows them to position themselves closer to the opposing team’s goal and therefore increase their chances of scoring a goal. This is a common tactic that can be seen at all levels of the game, including youth soccer.
Another reason why a player might fake an injury is to stop the clock. Despite their superior conditioning it is not uncommon for soccer players to get tired during a game and if they can get the referee to stop the game then they have a much better chance of scoring a goal.
It is important to note that there are a number of efforts that are being made to reduce the number of instances of soccer players faking injuries. These include the use of Video Assistant Referee (VAR) technology in some leagues and tournaments, stricter on-field penalties, and a cultural shift toward a more honest game of soccer. Let's hope that these initiatives will succeed in ensuring that soccer remains a fair and enjoyable sport for everyone.