An analogy is a cognitive process of transferring information or meaning from a particular subject to another, or a linguistic expression corresponding to such a process.“Life is like a box of chocolates—you never know what you're gonna get." That is an analogy
An analogy is something that shows how two things are alike, but with the ultimate goal of making a point about this comparison.
The purpose of an analogy is not merely to show, but also to explain. For this reason, an analogy is more complex than a simile or a metaphor, which aim only to show without explaining. (Similes and metaphors can be used to make an analogy, but usually analogies have additional information to get their point across.)