It was not the first time Ancelotti defeated a strong team like Man City. Ancelotti have proven that he is a great coach, specifically for UCL competition. He already won UCL titles 4 times, 2 trophies with AC Milan and 2 trophies with Real Madrid. Ancelotti surely knows well how to beat any team in UCL, he is an experienced and smart coach. So, I think it is not really surprising if Ancelotti could beat Guardiola.
Even though Ancelotti is old and in terms of tactics he is not as modern as Pep Guardiola, in terms of experience, Ancelotti understands the opponent's game. Manchester City could not be beaten in a 90 minute game so Ancelotti targeted his players to defend and let Manchester City control the game as much as possible. The Manchester City players have a very poor penalty shootout mentality, while Madrid are used to doing that and have experience with European teams in the past. Therefore, we can see that Madrid players have calm when executing.
Interestingly, Ancelotti will now face Bayern Munich and is almost even mentally. As for the difference in terms of tactics, Tuchel had his own grudge against Ancelotti in the past when he was still coaching Chelsea.