Was it the flaws of the Wehrmacht? Was it because the plans of the generals were too successful ? Was it because the numerical advantage of the allies?
Logistics and economics.
The overall GDP of the Allies, with the US in the war, was much greater than of the Axis. Moreover, the Allies knew how to play to their logistical strengths. The US cranked out more tonnage in new merchant ships than, say, the Japanese ever had. The US supplied the Soviets with trucks, railroad equipment, food, and raw materials to help keep their industry humming and to keep Soviet soldiers supplied and fighting. The Soviets undertook great efforts to protect their industry from the invading Germans, relocating entire factories well behind the lines, essentially building up entire cities dedicated to military production.
The Americans, British, and Soviets also approached manufacturing of military equipment as a balance between production and logistical supply versus capability and quality. The finest gun, aircraft, or tank in the world is of no use if it's not on the battlefield. The most effective gun is always the one in your hand, the one you have bullets for, the one that you are able to fire because you have food in your belly, and so on. There are tons of examples of equipment built to balance these tradeoffs among the allies. The British Sten Gun, a pretty sub-par gun but serviceable enough and millions were made during the war. The Soviet T-34, one of the finest tanks of the war in terms of capabilities but also if you looked at the inside it would seem like a prototype, nothing seems properly finished, but tens of thousands were made. Liberty ships. B-24s. Shermans. "Deuce and a half" trucks. Good enough equipment built in tremendous quantities delivered to the front lines wins wars. The front lines for American soldiers were half-way across the world in the Pacific and in North Africa or in Europe compared to where stuff was made. But the logistical train was so robust it was able to pump tremendous quantities of materiel across oceans to supply those troops better than Japan and Germany could with shorter supply lines. The Soviets had a slightly easier job of supplying their troops but the importance of the factory to front-line supply chain even there cannot be overstated.
Look at the war in the Pacific as an example. The Allies used submarines and air power to interdict Japanese shipping and smash their logistical supply trains. So much so that the home islands began to run low on everything from gasoline to food near the end of the war. The Japanese didn't attack Allied shipping in the same fashion, nor do so nearly as effectively, leading to a massive logistical imbalance that only became more imbalanced as the war went on. If you can't move the troops, feed the troops, or supply the troops you can't win battles, and you won't win wars.
Both Japan and Germany used their forces less effectively and used their production capacity less effectively (Germany much more so than Japan). Given that both powers were comparatively resource and land poor at the start of the war, allowing the resource and supply differential to amplify over the course of the war doomed both powers. There may not have been any way for either to realistically win a drawn out engagement given their fundamental disadvantages, but the deepening of those disadvantages allowed the war to run its course at a must faster pace than it might otherwise. Note that by late 1944 the Germans were so low on supplies that one of the key aspects of the German offensive that would become known as the "Battle of the Bulge" was to get deep enough behind Allied lines to capture the supplies (fuel, ammunition, etc.) to keep the offensive going.