It implies that a situation that looked good on the surface has a hidden problem or defect, causing disappointment.
Here's an example:
* "I was so excited to get this new phone, but then I found a worm in the apple when I discovered it doesn't have enough storage space."
This idiom highlights the feeling of being let down by something that was expected to be good.