Having your cake and eating it too is an idiom meaning that you want to do the impossible by disposing of or consuming something that you want to enjoy, while at the same time keeping it intact.
It’s an attempt to overcome an either/or situation.
It was first written down in 1562 as, “Would you both eat your cake and have your cake?”
And somewhere along the line it became, “Have your cake and eat it too.”
“Wolde ye bothe eate your cake, and haue your cake ?” – A Dialogue Conteynyng Prouerbes and Epigrammes of 1562 by John Heywood.
“Eat your cake and have it” – 1816 poem “On Fame” by John Keats.