As someone who is also interested in and participates in other sports, and who is currently coaching youth baseball, let me first state that the issue of kids leaving is not unique to chess. Young athletes leave sports such as baseball, football, soccer, etc. It is said that 70% of kids leave youth sports by age 13.*
That said ... In my opinion, this is not something for which there is a single answer. Factors involved include interest, opportunity, outside activities and needs, pressure, and social factors. I'll illustrate some of this via my personal experiences.
Chess was something that was of interest to me from an early age and I learned it at the age of 9. This was during the Fischer craze. I often played classmates during recess when weather forced us to stay inside. However, over time that fad faded and playing at school stopped. I continued playing at home against my step siblings for a while, but advanced to the point where I defeated them easily and they would no longer play against me. At that time, we lived in a relatively remote area and I had no one else to play against, so I (mostly) stopped playing for a few years. Even after we moved to a more populated area, there weren't many people I knew who played. So, for several years I didn't have opportunity to play.
When I got into high school, there was a chess club. I played there and began playing in rated tournaments. Inside the group, we enjoyed socializing with one another. However, outside our group, we were seen as nerdy outcasts, which people that age usually don't want (or at least didn't when I was that age). So, I'm sure there are teenagers who may be interested, but who don't play (at least publicly) for fear of becoming socially ostracized.
Pressure and burn out are things I didn't have to deal with, but some kids do. I mention it here because it is often around high school that this leads players to quit. Kids who are pushed hard for several years to learn any skill often feel overly pressured and eventually burn out. I have seen it coaching baseball, where kids are pushed by their parents and/or coaches to work hard at the game to become experts. Parents may want the kids to win scholarships and/or turn pro; some coaches will be overly obsessed with winning. Such pressure often turns kids off and leads to burn out and dropping out of the activity.
The college I attended didn't have a chess club. Also, with studies and a part time job, I had little time for the game. Furthermore, I did not have much money for traveling to tournaments (the closest I knew of were a one hour drive) or paying entry fees. So I again stopped playing.
By the time I graduated college, chess was only a mild interest. I usually had a chess program on whatever computer I had and would play it occasionally. Otherwise, I didn't play much due to work, other hobbies, dating, and - at times - night school. I did read the occasional article about the game in mass media (such as Kasparov vs. Deep Blue), but that was about it for a few decades.
Historically, another factor might be the means of study available. When I was young, the only resources I had for improvement were rather dry books - coaching would have been done face-to-face then and we were nowhere near a coach (nor would my family have spent money on one). Now there are videos, online lessons, and books that are more interesting than those I remember starting and abandoning years back. Coaching can be done online. Hopefully more people will take an interest and stay involved in chess.