In order to make (or bake) a Cake, you will need:
1. 9 iron ingots: can be found in caves as ore and obtained by a stone pickaxe. You will also need a furnace, made of cobblestone, and fuel (coal, wood, etc.) to smelt the ore into ingots.
2. 2 sugar: you will need 2 sugarcane, which are found usually near lakes and oceans. Once obtained, you can craft it into sugar using your inventory crafting slots.
3. 1 egg: dropped by chickens every 5-10 minutes. You can lure a chicken into a pen or compartment using seeds, and wait until it drops it. If you are playing the Tutorial world, there should be a chicken pen in the Animals section. Coincidentally, is it a chicken or a duck?
4. 3 wheat: can be farmed using seeds, and can also be found in village farms, woodland mansion farm rooms, and if you are playing the Tutorial world, there should be a Farming area that provides wheat.
Once all of the above items have been obtained, you can craft a cake using a crafting table. The option to craft it is in the Foodstuffs tab. Once crafted, this achievement should pop. If not, place it on the ground. If it still does not unlock, exit the game and make the world Offline.