WARNING: The following contains spoilers for My Hero Academia #306, by Kohei Horikoshi, Caleb Cook and John Hunt, available now in English from Viz Media.
Deku's sudden departure from U.A. is one of the biggest twists of the My Hero Academia series (can we still say "Academia" at this point?). Considering how much he wanted to go to U.A. and how much he treasures all of the friends he's made, this was a shock to everyone. But was it really that unexpected, considering the trajectory of the hero's journey?
From the moment All Might chose Deku as his heir of One for All, he was marked as different from the rest of his peers. Not only was All Might giving Deku an extremely powerful Quirk, he was also entrusting him with the fate of the world, making it inevitable that he would eventually leave U.A.
Heroes Can't Stay in School
Deku needed to go to U.A. so he could train his new Quirk and the Academy provided him the right environment and support system to do so. Despite how many times the school has been attacked by villains, it has nevertheless been a safe haven for students. And with the teachers being Pro Heroes, the students could always count on them to be there when things looked bleak. Deku knows he's been very blessed for getting the chance to go to U.A. because it's gifted him so many opportunities, including being mentored by All Might and finally talking to Bakugo on (somewhat) equal terms. But with Shigaraki and the villains continuing to grow in strength and numbers, he knew he couldn't stay in the comfort and safety of U.A. any longer.
The "Chosen One" leaving school isn't something new. Harry Potter left Hogwarts partially because the Horcruxes were scattered who-knows-where and Hogwarts had come under Snape and the Death Eaters' control. That would make it ten times more difficult to do anything, but ultimately it was because he couldn't bring any further danger to the only place he called home. It's similar with Deku -- his dream from the very beginning, even with all the odds against him because he was Quirkless, was to go to U.A. With the school turning into an evacuation centre and with Shigaraki targeting him, he couldn't stay there anymore without endangering everyone.
Heroes like Deku and Harry often leave school when they have hit their lowest point. For Harry, it was losing Dumbledore and being betrayed by Snape; for Deku, it was watching Gran Torino being pummeled by Shigaraki. We see how significant this moment was in the last panel of Chapter #306 as he appears to be wearing a scarf/cape as an homage to his mentor. If he remained at school, he would be drawing danger to their teachers and classmates.
School is a symbol of childhood and with Deku being forced to grow up early and fast, it makes sense that he would be the one to drop out of school first. He's undergone a lot more hardships than a normal teenager should and every battle won and lost has matured him to the point where he has an intrinsic understanding of his place in the universe -- to walk a separate, lonely path from everyone else.
Why Deku Had to Leave U.A.
In Chapter #304, Deku was told that he was the last wielder of One for All and is the superhero society's last hope to defeat All for One. He recognized that he didn't have a choice anymore: he couldn't walk away from his destiny so he had to walk away from U.A. and his friends. As great as U.A. is, it severely limits what he can and can't do.
One for All isn't a Quirk that destroys. As its name implies, it's a power shared by all that also has the ability to save all. Deku's goal right from the beginning was to be a hero who could save everyone. Now that the whole world knows the secret of One for All, they'll want to use it to kill Shigaraki. Deku, being one of the few to see that behind the villainous mask is a terrified young boy -- not that different from Deku himself years ago -- wants to use OFA to save him.
It's heartbreaking to see Deku in the last panel where he's standing on top of a building, alone and without his usual smile. He's had to sacrifice his childhood, friends, and any chance at a normal life to save the world. For people like Deku who run into danger without a second thought, being a hero isn't picking and choosing who's worthy to be saved or not. In My Hero Academia, it's saving anyone who needs help -- even if they're a villain.