Whirlpool:
Whirlpool inflicts 1/16 of the target's maximum HP as damage for two to five turns upon use, in addition to the damage dealt when it is used.
Infestation:
Infestation inflicts 1/8 of the target's maximum HP as damage per turn for four to five turns upon use, in addition to the damage dealt when it is used.
Both have same effect. As per your question, when it is used, they respectively do Bug and Water-type damage. However, the damage during when it was trap, is set to 1/16 (whirlpool) and (infestation) and are typeless, i.e. the damage is set damage but the damage when it's used is of its type.
Hope this helps!