HS teacher here and I’ve had a few graduate early for different reasons. It could be sports to start college with the team, personal reasons, or they don’t like HS and want to get it over with.
As the other poster said, they need a certain number of credits and when they are fulfilled they are done. Most are done by the end of 11th grade for a standard diploma for many kids and they only need English 12 and maybe 1 or 2 more, if that. They can plan ahead, double up junior year, take them in the summer and/or take online classes. Usually it’s a combo of all of that. It’s not that hard to hit the minimum credits and school is more flexible now with so many virtual class options.