When Rudolph W. Giuliani went to Madrid in August to meet with a top aide to the Ukrainian president and press for political investigations sought by President Trump, he made the trip at the behest of a previously unidentified client with very different interests.