Esoteric meaning (ta'wil) of Hazrat Yunus Spending 40 Days Inside the Belly of the Whale
Qur'an 37:139-148 recounts the story of Hazrat Yunus (Jonah). It says that he cast lots, which is the act of throwing marked stones, sticks, or dice to arrive at an important decision or conclusion about God's will. This was an "act worthy of blame".
Then a (big) fish swallowed him and he had done an act worthy of blame. (Qur'an 37:142)
Allamah Nasir al-Din Hunzai tells us the esoteric meaning of Hazrat Yunus spending time inside the big fish:
"Hazrat Yunus warns us of the danger of a great whale (nafs-i ammarah, the carnal soul)."
- Allamah Nasir al-Din Hunzai, Book of Healing (tr. by Faquir Muhammad Hunzai & Rashida Noormohamed-Hunzai), p. 170-171
So that would mean that before rising to higher levels of soul such as Nafs-i Lawwamah (the self-rebuking soul - feels guilt or regret for its misdeeds/sins) or further to Nafs-i Mutma'innah (the soul at peace), Hazrat Yunus spent time at the lower level of carnal/animal soul before escaping it to advance spiritually.
Mawlana Hazir Imam has said that "it is the light of the intellect that distinguishes the complete human being from the human animal..." Human animal refers to the person who has nafs-i ammarah, the carnal soul. The whale, being an animal, emphasizes this point. Through recognizing and surrendering to the intellect and following the guidance of those who have souls already at peace instead of simply following one's Self, one can rise higher. We may ask who are those souls at peace in Qur'an 89:27? It is the pure Imams.
"And by addressing us through the verse ‘O Soul, at peace!’ he granted us an exalted tranquility."
- Imam Hasan ‘Ali Shah, Aga Khan I ‘Ibrat-afza tr. Beben and Poor (p. 122)
Fortunately, anyone that desires can, through rigorous self-awareness and self-work, achieve higher states of the soul as said by Imam Sultan Muhammad Shah.