Rashi on the talmud (kidushin 49a) says the aramaic translation/commentary on the torah was given at sinai, forgotten and brought back by Onkelos.
Where did Onkelos obtain the correct text?
This should not to be taken literally but metaphorically meaning that Onkelos' translation is considered as it were from divine origin, handed to Moses at Sinai.
See: Targum Mi'Sinai? by Rafael Binyamin Posen, available in JSTOR here.