This English expression is used as a metaphor and does not relate in any way to cats or bags!
The expression is used to denote that someone has revealed some information which was previously concealed. It is often used when a surprise has been ruined by a slip of the tongue.
There is no definite origins of this expression but it is suggested that it dates back to 1530 and the fraud of substituting a cat for a piglet at markets. At this time markets were commonplace and the literal substituting of a cat for a pig in the bag at a market was frequent. The sellers would sell the “pig” in a bag, but instruct the buyer not to open it until they get home, under the pretence that this would mean the pig could escape.The buyer would carry the bag all the way home, only to have it revealed when opened that they had received a cat instead of a pig. The first known use of the phrase in print is from a 1760 edition of The London Magazine which writes “We could have wished that the author… had not let the cat out of the bag.” Cats are very common in English proverbs although it is not clear why this is. They appear in “curiosity killed the cat” and “when the cat is away the mice will play,” among many others.
An example of this expression in context can be found on the BBC news website in an article from February 2015 about Prime Minister David Cameron’s spending plans regarding budgets. A quote in the article from the Labour Party reads “Labour said he had “let the cat out of the bag” while the Liberal Democrats described it as a “real-terms squeeze”.