That is precisely what an analogy is: it is the comparison of one thing to another, often very different, thing. It is used to make something that is less familiar more easily understandable by comparing it to something that you understand far better. For instance, one common analogy is the one between the structure of an atom and the solar system; it is said that the nucleus of the atom is like the sun in our solar system, and the electrons revolving around the nucleus are like our planets revolving around the sun. Another one is a very famous Shakespeare quote from "As You Like It" Act II, Scene VII:
All the world's a stage,And all the men and women merely players;
They have their exits and their entrances,
And one man in his time plays many parts...
Similes and metaphors are ways of making an analogy. One example that is a classic is Forrest Gump's "Life is like a box of chocolates."