You've receive many suggestions but thought I'd add mine...
We're have an opposite situation, we just switched gyms and it's about an hour away.
Gym starts at 4:15 on a Tuesday and 4 on Fridays.
School gets out at 3:15, by the time the kids actually get out it can be 3:20.
Before we committed to the gym, the gym and I made certain arrangements.
I've also checked with the principle/headmaster and teacher for the best day.
Based on the school, we agreed that dd can only leave early one day a week, on a Friday.
Lessons technically ends at 2:30 and the rest of the time are used for assembly - a get together of the whole school to give out awards for the week and to see which house earned the most points... think of Harry Potter's house points winner announcement at the end of term sans the food, magic and ghosts.
We agreed that being late by a few minutes, or 15 minutes, will be ok on a Tuesday.
My dd is 7 so I have to be involved.
I know you're older but it might not be a bad idea to have your parent(s) talk to your new school and maybe also the gym.
I don't agree with missing a lot of school but as an educator, I have to agree, that last few minutes of school tend to be useless. Even when lecture is going on, students' attention span has gone down to 50% or even nil
No matter what, school should be the most important.
Gym only last for so many years where school, education and knowledge, will be needed to get you through the rest of your life. Even with us, when we drive to activities, we'd bring the iPad and I have different math assignments ready to go in there. On Thursdays I'd record my voice on the iPad, on a spelling app, and on our drive, even if it's 15 minutes, she'd do spelling. Or, I'd save an article on the kiddie Wikipedia on whatever topic and have her read and we'd talk about it.