Yes, corrupting youth and impiety were the headline accusations. But really, it comes down to the fact that he pissed a lot of people off. You only just need to read some of the dialogues by Plato to see what a massive pain in the arse he was, and it's not hard to imagine that in some he is deliberately screwing with his opponent and making them look a fool. Likewise Aristophanes's The Clouds suggests he had a well-known reputation as a troublemaker.
And yes, to be fair, he got himself executed. It was standard practice in Athenian law for prosecutors to demand a ridiculously severe sentence that would be bargained down in the trial. My take is that Socrates defends himself from conviction seriously, but after the guilty verdict rolls in and the sentencing is being debated, rips up a storm by effectively mocking the trial system, jurors, and trivialising any lesser punishment they may consider. I've heard someone argue this was a gambit to shame them into letting him off - if so, it backfired horribly. Credit to him though: took a lot of balls whether he chose death or just risked it.