A malfunction caused the explosion and fire Monday night during a fireworks show on the Plymouth waterfront.