There is indeed a principle behind the ordering of letters in Indian languages taken from Sanskrit, and AFAICT Tamil also follows it.
If we look at it rowwise, the first row is the velar consonants, then the palatal then retroflex then dental then labial. If you notice here, we are gradually moving from the back of the mouth to the front!
If we look at it columnwise the first column consists of unvoiced/voiced consonants and the second column consists of nasals.
Then come the semivowels
ய் ர் ல் வ் ழ் ள்
After that
ற் ன்