What is the origin and meaning of the idiom lay an egg? I believe the phrase is usually used for when a team goes out and plays really badly, but I am not certain why.
This was show-biz parlance in the 1920s, and it referred to a show that closed quickly after opening. The most famous usage was by Variety (a show-biz newspaper) in 1929 after the stock market crashed: "Wall Street Lays An Egg"
Some sources I have seen say that the original meaning came from the number 0, which is what is put up on a scoreboard when a team fails to score. It resembles an egg, and is still today called a "goose egg," so by extension when a team scores zero it "lays an egg."
The OED says "lay, v. ... 9. ... figurative phrase to lay an egg, used in various colloquial senses, specifically: (a) (of an aircraft) to drop a bomb; (b) orig. U.S. (of a performer or performance) to flop." with earliest citation for sense (a) from 1927 and for sense (b) the 1929 Variety headline quoted by Robusto.
This phrase thus seems to be unrelated to the "zero" sense of the word egg, though it's possible that its use in sporting contexts is influenced by it.
The OED says of the latter: "duck's egg, n. The egg of a duck; hence, in Cricket, the zero or ‘0’ placed against a batsman's name in the scoring sheet when he fails to score; no runs; hence, generally in school-boy slang, ‘nought’" (earliest citation 1863).
I must move in a somewhat anal environment. I just asked three people what lay an egg might mean in a non-literal sense. One thought it could refer to programmers writing hidden Easter eggs in software packages, the other two knew it was what cats do when they deposit a turd somewhere exceptionally unwelcome (your pillow, for example).
I didn't prompt them until after they'd answered, but I'm in no doubt that I side with the majority there. I recall a Garfield comic strip where after some slight, the cartoon cat leaves his "calling card" in hapless owner Jon's shoe. That was an idiom defined, for me!