Letting the cat out of the bag, is a metaphor for revealing a secret. It is far easier to keep a cat in a bag, than to put the cat back into the bag after it is out. Cats, like secrets, are very independent creatures that do not do as they are told; they follow their own desires. Once revealed, a secret cannot be made secret again; it spreads and becomes known to one and all.
Example: "Billy was having an affair with Jessica, but his wife didn't know. Jessica started bragging about it and one of her friends told Billy's wife. Now the cat's out of the bag and Billy's wife is probably going to divorce him." The consequences of a secret being revealed cannot normally be undone. Once the cat is out of the bag, it stays out.