How did it burn so long? Because it was loaded with way more fuel than required for the planned burn.
Why did it burn so long? Because it was trying to make orbit with less thrust.
If some of the engines don't fire, then the lift takes longer, and every second it spends in the atmosphere represents more energy lost to drag and more fuel spent to counteract gravity instead of accelerate the rocket. So if you lose an engine, you need more fuel than planned in order to reach the desired speed and altitude. If you lost an engine but burned the same quantity of fuel, you'd end up low and slow.
The extreme case would be if you lost enough engines that you're precisely countering gravity with no extra thrust, in which case you could spend an infinite amount of fuel without ever reaching orbit because you'd just be maintaining your speed but not getting any faster. (Technically that wouldn't happen because the rocket is getting lighter as it burns fuel and gravity drops off as you move away even if you're only maintaining current speed, but it should help clarify why you burn more total fuel when your thrust output is lower.)
The Superheavy was loaded with a good bit more fuel than required for the planned burn. The flight plan included having the booster perform a boostback and simulated landing after stage separation, so it could cut into the fuel meant for its return trip in order to try to complete the primary mission. Even beyond that, they may well have launched with more fuel than needed for the planned mission -- there are reasons to launch with a nearly-full load of fuel instead of half-a-tank, such as the structural stiffening that comes from having the tanks closer to full. In any case, they had plenty of extra fuel aboard. When the engine cluster started badly underperforming, the rocket automatically adjusted its angle and extended the burn time in an effort to reach the intended altitude. As the flight goes on, you can see in the telemetry that the angle of attack starts to go higher and higher as the rocket aims its nose upward instead of directly into the airstream.
Eventually either it overcontrolled, getting the angle of attack far enough off center that it could no longer maintain the position against the aerodynamic forces, or it had been leaking hydraulic fluid (possibly due to damage from debris thrown up when it wrecked the launch pad) and the gimbals got unresponsive, or both, or some third thing, but in any case it wasn't able to maintain orientation (the Starship/Superheavy stack is inherently unstable due to Starship's winglets) and it started to tumble.