The cause of T1 is a bit of an unknown, genetics plays a part, stress and some random virus may do too, but there's broad agreement that lifestyle has nothing to do with it, it's very much a luck of the draw disease.
The good news that after 100 years the treatment for T1 diabetes has improved dramatically. I've been T1 for 50 years (first 13 pre glucometer) and am aiming to have another 20 in good health (my T1 mother got to 78 and would have lived longer if she had not smoked for 50 years) but the outlook for young T1s is really good (maybe even the cure that they've been promising in the next ten years for my entire T1 life).
It's not an easy condition, you have to keep monitoring and injecting (or get a pump) but once you get the hang of it there is very little that it stops you doing (army and astronauts are out though). No need to give up sport, it will keep you healthy, just get used to keeping glucose tablets (or equivalent) nearby to counteract any hypos.
It's a hard adjustment to make but your life is by no means over. Just as an asthmatic has to carry an inhaler, you have to carry glucose tablets (and insulin and a glucometer). There's a steep learning curve, but once you've gone through it your diabetes should fade into the background. Diabetes only makes me ill if I don't get my insulin dose right, normally I am fine.
I expect some younger T1s will post soon, you are never alone on these forums.
Good luck and welcome to the forums.