That's as easy as pie! Wait a second, that's the wrong phrase, but it's meaning is identical to a piece of cake; both expressions convey the idea of simplicity. The question is: Why? What makes cake "easy," anyways? Well, I doubt it's referring to the cooking process involved with baking a cake, because that requires a fair bit of work. You have to crack eggs, mix stuff up in a bowl, set the temperature of the oven, and so on. Alright, it's not that complicated, but it still requires effort, so much so that some people don't even care to bother with it.
Do you know what is easy though? Eating a baked cake! Yeah, that's a pretty easy thing to do because it tastes good. Thus, this phrase may possibly get its "easy to accomplish" meaning from how simple it can be to eat a piece of this delicious desert. However, that is simply a guess; the origins for this phrase are not certain.
The figurative meaning of this phrase goes back to at least the 1930s. The term is used by an American poet named Ogden Nash, who wrote Primrose Path in 1936. There's a quote from it that reads:
* This upcoming bicycle race will be a piece of cake for me because I've been going through exhaustive training sessions these past few months to prepare myself for it!