It's a metaphor that compares a task or activity to eating a piece of cake, something that is generally considered simple and enjoyable.
For example, you might say:
* "Passing that test was a piece of cake."
* "Fixing that computer problem was a piece of cake for me."
The expression is often used sarcastically to emphasize the fact that something is actually quite difficult, but the speaker is pretending it was effortless.