A metaphor is a comparison that does not use the words "like" or "as." "Ozymandias" is not a sonnet heavy on metaphors, but we can locate a few. For example, the "two vast and trunkless legs" of stone of Ozymandias's statue are a symbol for the futility of human glory. Shelley is metaphorically comparing Ozymandias's quest to be the great king who everyone fears, even other rulers, to the broken statue he has become. Like the statue, Ozymandiass' kingdom is shattered and in ruins, buried in desert sands, as is Ozymandias himself. He is no longer mighty and fearsome but, like his statue, a pathetic reminder of long-lost power.
The "boundless and bare" sands of the desert are also a symbol for the relentless way time buries all human achievement by patiently outlasting the span of human civilization. We can consider how these sands function metaphorically in the mental image this poem creates as well.
The two existing educator answers have already addressed the key things to be aware of in terms of metaphors in this poem. There are few "obvious" metaphors; we do not see the most common metaphorical construction in which something is stated to be something else without literal truth ("the curtain of darkness," "the moon's a balloon"). We can find some examples; "the heart that fed," for example, is a metaphor. The heart did not literally feed but rather it metaphorically sustained. The "hand that mocked," similarly, is a type of rhetorical device known as synecdoche, in which the "hand" does not mean literally the hand alone, but is a representation of the person who owned the hand and who did the "mocking."
In a broader sense, however, the "trunkless legs of stone" and the "shattered visage" which lies "half sunk" in the sand is a metaphorical representation of Ozymandias's hubris. The inscription on the pedestal has become ironic because Ozymandias once expected the mighty to "despair" because his works were so evident and vast, and yet now the "despair" comes only from the fact that the statue is a "Wreck" and "nothing beside remains" of Ozymandias's once great works. The statue, submerged in the desert, is a symbol of pride before a fall, Ozymandias's misplaced belief in his own longevity now sunk in the middle of nowhere, with no indication of what he had to be proud of.
While there are definitely metaphorical components to Shelley's famous sonnet, it should be noted that there are few direct metaphors in the poem.
The "lone and level sands" that "stretch away" can be a metaphor for time. Centuries of time have past, like sands through the hour glass, piling up to bury the memory of Ozymandias's greatness.
Finally, the description the poem relates of the fallen statue can be taken as a metaphor of the transitory nature of individual human fame and achievement. No matter how important an individual may seem in his day, even a ruling tyrant who subdued many people, his fame and achievement will crash and fade until time erases all but the poorest remnants of the person's former greatness, just as the desert has claimed the dominion of Ozymandias.
Although the poem does not have many overt metaphors, it contains many subtle comparisons that the careful reader can unearth.
A metaphor directly equates two things which in literal terms are unrelated. There are multiple examples of metaphor in "Ozymandias," not limited to the ones listed below.
The first is found in the first line, "a traveller from an antique land." Normally, we reserve the word "antique" for old objects, specifically ones which can be collected or easily owned. We would not normally apply the term "antique" to a region or country, so this association may be intended to convey something of the speaker's poor, stereotypical, or one-dimensional understanding of the traveller's origin; perhaps he sees the land as "antique" in the same way that popular generalizations of "the Orient" or "the jungles of Africa" do not really represent those places in truth.
Another metaphor is the "sneer of cold command." Command is not literally cold, as in temperature, but cold in terms of human emotion and empathy. The "shattered visage" is described as cruel, dispassionate, and haughty.