Two weeks after national elections in April vaulted him from the role of television comic to Ukrainian president, Volodymyr Zelensky got word that President Trump’s personal lawyer wanted to come to Kyiv to talk.

Mr. Zelensky and his advisers, many of whom were ex-producers and screenwriters, huddled over the request. Before his improbable rise, Mr. Zelensky didn’t know who Rudy Giuliani was, according to one aide. By now, though, Mr. Zelensky sensed trouble. In an April 7 appearance on Fox News, the former New York City mayor had made it clear he wanted information about his client’s political rival, Joe Biden, and his family.

Mr. Zelensky, fearful of getting sucked into a foreign drama when he had plenty at home, declined to take the meeting.

He got sucked in anyway. Over the next several months, Mr. Zelensky’s administration tried to sort through conflicting signals from Washington that have now become central to an impeachment inquiry into Mr. Trump. A summit dangled by the U.S. leader kept receding. At the last minute, it was announced that Energy Secretary Rick Perry would be attending his inauguration instead of Vice President Mike Pence.