I used a euphemism in the title, and admit that my limited searching did not find an origin. The Phrase Finder observes that the US expression is something like “…When you’re up to your (ears) in alligators, there’s no time to remember you’re there to drain the swamp.” The obvious meaning is that you can’t hope to solve problems if your primary hope is for survival.