The addition of The Lovin' Spoonful was a studio imposition to bump up the running time. Woody Allen was so incensed by this that he threatened to sue the studio, although he later recanted when the film became a hit.
Woody Allen and a group of friends only did 60 minutes of dialogue for the movie. An additional 19 minutes was recorded using an actor mimicking Allen, plus footage of The Lovin' Spoonful. These additions were made without Allen's consultation.
American International Pictures bought the 1965 Japanese film "Key of Keys" for $66,000. However, the studio quickly realized that it was far too confusing for Western audiences. AIP president Henry G. Saperstein came up with the idea of turning the original inscrutable thriller into a comedy by dubbing it with different dialogue. As Woody Allen had just scored an unexpected hit with his screenplay for What's New Pussycat (1965), Saperstein hired him.