This is a common phrase that is used to say that a task is relatively easy. When someone is doing something that is as easy as enjoying a piece of cake, it is really easy.
This is often used as a boastful exaggeration when a person is trying to make it appear that something challenging was easier than it actually was.
For Example:
“Winning the world championship was a piece of cake.”