The same way that the early explorers and missionaries learnt the native languages of Southeast Asia and South America. You begin with pointing and other gestures, and slowly build from there.
Children younger than five are much better at this than older kids and adults, so we could train a generation of interpreters by raising children in a mixed human and alien environment.
If the aliens were particularly strange, we might not actually be able to speak their language at all. Han Solo and Chewbacca can understand each other, but Han never speaks a word of Wookiee.
Subscribe to BBC Focus magazine for fascinating new Q&As every month and follow @sciencefocusQA on Twitter for your daily dose of fun science facts.