When the tank reaches 0 wounds it is destroyed. The explodes happens as a special rule after the fact. But the very moment it hits 0 hull points the unit is done.
https://www.games-workshop.com/resources/PDF/40k/warhammer_40000_en.pdf Pg 7.
5.
Inflict Damage: The damage
inflicted is equal to the Damage
characteristic of the weapon used
in the attack. A model loses one
wound for each point of damage
it suffers. If a model’s wounds
are reduced to 0, it is either slain
or destroyed and removed from
play.
Since explodes cannot happen until the tank has been destroyed then the order is clear.
Failing all this, if an opponent really disagrees and everything is taking place simultaneously, then sequencing rules come into play. The player whos turn it is determines the order of operations and decides which unit actually died first.