It was originally a classical piece called "Dance of the Hours" by Amilcare Ponchielli. Allan Sherman was a master at musical parody -- taking a piece of music and writing different words for it.