Why does one need to wait 24 hours before being able to toivel a vessel belonging to a gentile, what is the purpose of those 24 hours
It is not because of the toveling, but because it has to be kashered first. After buying a used metal or glass utensil from a gentile we have to kasher and then tovel it. We have to kasher the vessel from any absorbed non kosher taste that might have been absorbed in the walls of the vessel. Before kashering a non kosher vessel we have to wait 24 hrs. so that the absorbed taste will not longer be able to give a positive taste, (called aino ben yomo). After it is kashered we can now tovel the vessel. If you buy a new vessel from a gentile, or a utensil that is not used for hot or sharp foods there is no need to wait 24hrs.
Shulchan Aruch Y:D 121-1,2..