It's from SUPER MARIO BROS. 2. At certain times you had to pick up a key to unlock a door. Taking hold of the key would wake up the "Phantom Head" (as my brother and I always called it), and if you held the key for a certain period of time, it would come chasing after you. If you weren't fast enough, you'd have to drop the key, wait for it to disappear off screen, then pick up the key again and race to wherever you needed to take it before it would show up again.
It's the scene from the 1966 Batman movie where Batman is trying to dispose of the bomb on the pier. But the bomb has been replaced with the key thingy.