بسم الله الرحمن الرحيم
It is required to apply the definition of fish to the Whale keeping in mind the definition of fish described by the zoologists. If the definition of fish applies to it then there shall be no problem though it is mammal and it shall be lawful to eat it. The definition of fish as per the zoology books is: A creature with backbone that lives exclusively in water and breathes through gills.
As per the view of Mufti Kifayatullah sahib Whale is the Anbar fish and it is halal without any doubt. For detail, see: Kifayat al-Mufti, vol. 9, pp. 134-137)
Allah knows Best!
Darul Uloom Deoband