Basically it was Ash-Greninja, the anime-exclusive super mode that was added a bonus into S&M and some super sync not-Mega-Evolution excuse that Ash and Greninja had. Against the Mega Charizard X of Alain, an anime-only character that was fighting Legendaries with his almost-unstoppable aforementioned mon and pretty much constantly tanked hits no matter how absurd it was. Ash-Greninja lost because he didn't bother to dodge for dramatic purposes, and Mega Charizard X (as well as just plain Charizard) took hit after hit after hit, and just hunched over before shrugging them off and then finishing Ash-Greninja with a Blast Burn in a cross hit trade between the two.
Keep in mind the episode was trying to hype up Ash as having the advantage and high probability to win, and Ash had fought Alain twice before and lost, so everything was set up for finally getting the win until that shit happened. Then Ash got whooped by Lysandre and captured, and Alain and that one loli had to work together to save Ash and stop Lysandre for the final battle.