This is pretty puzzling as we know Signal is reputed to be secure (apart from having to provide a phone number to register) and although Telegram's default settings allow access to metadata and even message content ultimately, both have been banned because they have been proven before not to release any user data.
But why was WhatsApp not banned in Iran, and neither in Russia previously either? This is what is really puzzling many people? It would be pure unfounded conjecture to speculate whether WhatsApp provides metadata about who contacts whom, locations, etc to authorities as we've not seen evidence of this yet as far as I know. We do not know this but all the same, the question does need to be asked.
If you are in Iran I'd recommend though that you install XMPP, or P2P apps such as ManyVerse or similar anyway as centralised apps are just too easy to monitor or disable.
See Iran blocks Signal messaging app after WhatsApp exodus
With Signal shut down, WhatsApp and Instagram remain the only two unblocked major social media platforms.