In the story Tom had immense power, but was not interested in exercising it or exerting it outside his little patch of Middle Earth.
The implication is that he is some sort of Maia or something similar who has been there since Arda was created.
While the Nazgul and presumably Sauron's armies couldn't overpower him, if Sauron himself came, Tom would be destroyed.
More critically, Tom couldn't be trusted to keep the Ring safe because that's not the way his mind worked. He'd lose it or give it away without thinking about it.
He just was not a serious or responsible person.
Here's a quote from JRRT on his character: " The story is cast in terms of a good side, and a bad side, beauty against ruthless ugliness, tyranny against kingship, moderated freedom with consent against compulsion that has long lost any object save mere power, and so on; but both sides in some degree, conservative or destructive, want a measure of control. But if you have, as it were, taken 'a vow of poverty', renounced control, and take your delight in things for themselves without reference to yourself, watching, observing, and to some extent knowing, then the questions of the rights and wrongs of power and control might become utterly meaningless to you, and the means of power quite valueless..."
There are many who think Tom is one of the Valar, Tulkas in particular because there are a lot of similarities between the two and their wives.