From the Super Mario Wiki
It is given to Mario by a "fan". Mario's partner eats it first, but before they have time to give some to Mario, they start to feel sick and Mario will have to fight the next competitor alone. Before fighting with Rawk Hawk, he reveals that he tricked them into eating the poisoned cake. If Mario decides not to eat the cake (though Mario's partner will say otherwise), Shellshock will eat it instead and is thus the one to be poisoned.