Have your cake and eat it too?

Can someone explain this saying? Like if I had cake in front of me obviously I would wanna eat it. It’s MY cake. Thats what you’re supposed to do. It never made sense