Why didn't Zelensky just announce an investigation?

He was also still trying to get invited to the White House, which had been dependent on announcing the investigation. Dangling carrots in the form of personal meetings runs in the family.

Zelensky, like every other leader in the world, knows exactly how much a clusterfuck getting involved with Trump is, so he was reluctant to do anything. But he was also in a bind, in that he knew Trump had massive leverage over him. It was a no-win scenario. If he stands up to Trump, he gets on Trump’s shit list, and Trump is notoriously petty, and keeps his shit list forever. But, if he gives Trump what he wants, then Trump owns him - and everyone who’s ever worked with Trump knows that when you give him what he wants, he turns around and asks for more. Today it is “Announce an investigation into Biden”, but it’s a certainty that it would end up “Announce that Biden is the most corrupt person ever, and every Democrat in the world is his willing accomplice!”

Zelensky had an impossible choice to make, and lucked out in that he dithered just long enough for the whistleblower to save him.