For children across America, Christmas 2000 came tied in and branded. Whether Santa delivered a Rugrats "snuggle blanket", a 102 Dalmatians-themed salt shaker or a plastic waffle toaster bearing the lurid imprint of The Grinch, something tacky and movie-related would routinely be sitting under the tree. Unless, that is, they expected spin-offs from The Emperor's New Groove, a boisterous animated comedy set in a mythic South American province. Because, in a business where success is measured in merchandise, Disney's latest cartoon romp barely even registered. No snuggle blanket; no waffle toaster. Just a computer game, storybook and soundtrack - the last (in essence) half a new album by Sting.

Not, sadly, that anyone wanted them anyway. Despite a release date of December 17 - with the promise of repeat visits by fractious kids during the school holidays - The Emperor's New Groove had, by Christmas day, already bombed. And then it bombed some more. And now, two months later, there is a $20m shortfall on its $100m budget, cementing the film's status as the present the American public didn't bother opening. This has a particular bathos, for the film was in development for six years, during which executives dithered, directors broke down, pop stars fumed, and a work-in-progress lay discarded in the cutting room, leaving observers wondering if Disney had finally lost the plot.

Amid the bungling, even the title - that meaningless, off-putting title - was a botch, selected only as the least awful of the alternatives. Disney had already got rid of the original title Kingdom of the Sun, when the film began to resemble less and less its original conception, a loose reworking of Mark Twain's The Prince and the Pauper, set among the ancient Incas.

But back in early 1995 the movie had looked the very safest of bets, particularly when veteran animator Roger Allers signed up as director. After all, Allers was a man with a name for commercial hits, the man who had recently taken a moribund screenplay called The Lion King and turned it into a massive success story.

Which may be why Disney's then chairman Michael Eisner gave Allers such an unusually free rein with both the casting and the storyline. The movie was to be punctuated by eight musical offerings from Sting (hired on condition that his film-maker wife Trudie Styler could document the process), and Twain's story remained central to Allers's vision, its main characters the arrogant young royal Manco (voiced by comic actor David Spade) and humble lookalike Pacha (the fast-rising Owen Wilson). From there, however, the film took some distinctly arcane turns, veering into an involved sub-plot concerning an evil sorceress named Yzma and a self- consciously allegorical plan to steal the sun. Manco, by this stage, had turned into a talking llama. Obviously.

The response at test screenings was tepid. Yet the mantra echoing through Disney's Burbank headquarters appeared to be: "Remember The Lion King". Busily sealing tie-ins with McDonald's and scheduling a release in the far-off summer of 2000, Disney remained convinced that, given enough time, Allers would turn up trumps once more.

Until, inevitably, it changed its mind. It was now 1998. Allers was crawling towards completion; and, most importantly, Disney's follow-ups to The Lion King (the inane Pocahontas and ill-fated Hunchback of Notre Dame) had flopped. The studio had certainly done well in the meantime - but only thanks to its distribution deal with the recently formed Pixar, the company whose debut was the inspired Toy Story. It was decided that Allers's team needed an infusion of the zany. Enter Mark Dindal, a fresh-faced animator with a yen for slapstick. And so, over the next few weeks, the pair worked in tandem - Allers piling on the portent, Dindal churning out sequences as peppy as his colleague's were sober. The relationship couldn't last.

The end came late that summer, when an executive strode into producer Randy Fullmer's office, held his thumb and index finger a quarter of an inch apart, and muttered - with the warmth studio executives are famous for - "Your film is this far away from being shut down". Shaken, Fullmer called Allers. Equally shaken, Allers demanded a deadline extension. The request was denied, and he quit the project. Upon hearing the news, an apoplectic Eisner gave Fullmer two weeks to prove the movie was viable.

In a state of panic, Fullmer and Dindal set to work. They eviscerated Allers's screenplay, keeping in what test audiences had liked and abandoning what they didn't. And, mostly, what they didn't like was the whole thing. A fortnight later, Dindal re-emerged with the outline of a mildly hip buddy movie, in which Pacha was now a slobbish yokel voiced by John Goodman and the sun stayed firmly where it was. Manco, meanwhile, had been renamed Kuzco following Fullmer's horrified discovery of the Japanese slang term omanco (polite translation: vagina). He still turned into a llama. Eisner, with $25m already sunk into the film, swallowed his reservations and gave it the green light. Again.

The fun didn't end there. It would take another six months to get the retitled Emperor's New Groove back in production. A deadline extension was now granted to Dindal, with Disney's prehistoric epic Dinosaur yanked forward to summer 2000 to compensate. And then there was the Sting problem - that, with most of the original movie gone, all his songs except one were suddenly surplus to requirements. The call was not one Fullmer was looking forward to. He would surely have looked forward to it even less had he known Trudie Styler would be filming her husband just as the phone rang. The subsequent exchange soon became the centrepiece of Styler's documentary The Sweatbox, about to open in the US and prove for the record which is more tempting to audiences: an "angry and perturbed" Sting being dispatched, or a talking llama.

And finally the film was ready. The reviews, unexpectedly, were good. Since it was released in direct competition with Disney's own 102 Dalmatians, the box office receipts were not. At the end of its opening week, The Emperor's New Groove banked just over $9m. The Grinch, by comparison, made $55m in its first seven days. It was the studio's worst-performing animation in four years. The last holder of that record, Hercules, had cost $30m less to make.

Which only leaves the post-mortems. Within days of the film's opening, the industry was alive with whispers that the wrong Kingdom of the Sun had been given the go-ahead; that both versions were doomed by the incompetence of middle- management; and that the real reason Allers's grandiose vision was ditched had nothing to do with release dates and everything to do with smaller budgets.

And, most damagingly, the perfectionist, money-no-object Disney, which revolutionised movie animation with Fantasia and its ilk, was discredited. So, as The Emperor's New Groove arrives in the UK, spare a thought for Roger Allers, for Mark Dindal, and even for Sting. And be sure to listen out for Uncle Walt spinning furiously in his grave.

 The Emperor's New Groove is out on Friday.