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?
Mi Yodeya is a question and answer site for those who base their lives on Jewish law and tradition and anyone interested in learning more. It only takes a minute to sign up.Sign up to join this community
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.