Kerala’s past history of having had been an erstwhile part of one of the three Tamil Kingdoms…
Is the above sentence correct? How do we express that Kerala had been a part of Tamil Nadu, while retaining the sentence as it is...?
It is not correct. '...history of having been a part of...' is correct.
Omit "erstwhile", as it is redundant.