It is taxed when you receive it, not when it was due
Because you never received the rent when it fell due, it was not taxed then. The law catches it on receipt instead: arrears of rent and unrealised rent that you recover later are deemed to be your income from house property in the year you actually receive them (Section 25A). So a payment that clears years after the tenancy is taxed in the year it lands, not the year it originally related to.
A notable feature is that this holds whether or not you still own the property that year. So even if you have since sold the flat or moved abroad, recovering old unpaid rent on it is still taxable as house-property income in your hands in the year of recovery. The charge follows the recovery, not the ownership.
The 30% deduction, and the NRI mechanics
The recovered amount is not taxed in full. Section 25A allows a flat 30% standard deduction on the arrears or unrealised rent recovered, mirroring the standard deduction on ordinary rent, so only 70% of what you recover is taxable. That keeps the tax on a lump-sum recovery reasonable.
For an NRI, this is Indian house-property income of the year of receipt, reported on your return like any other Indian income. If the payer is in India and remits the amount to you, the payment to a non-resident attracts TDS under Section 195, which you reconcile on your return. And moving the recovered rent out of India, from your NRO account, goes through the usual Form 15CA and 15CB route once the tax position is clear. A practising CA reports the recovery in the right year, applies the 30% deduction, and handles the TDS and the repatriation.