Remember that old joke about two people deciding which restaurant to go to?
Alice: I know a place where we can eat dirt cheap.
Bob: But who wants to eat dirt?
Well, these guys do, apparently.
There's a tendency in fantasy to have certain species or characters, especially stone-based ones, eat earthen materials. Often, this extends to having their entire diet consists of these things, and they're unable to digest pure organic matter. Analogies to actual human food may be drawn as well: nitrogen-rich soil may be especially tasty, for instance. Gemstones may be considered rare delicacies or quartz may clog arteries.
How they get their nutrition from eating such materials is never explained, but presumably, if they're different enough to find rocks tasty, their nutritional needs are far different from ours.
The dragons in the Age of Fire series. Justified as eating metals is what makes their scales so strong, and failure to do so regularly is equivalent of vitamin deficiencies. In fact, AuRon is special for averting this, as he is a rare scaleless dragon and so doesn't need to eat any, allowing to live far from the hominids who mine the stuff.
In the Tortall Universe, basilisks eat rock, which is why they turn their prey into stone. They regard some types of rock as more edible than others, and certain gemstones qualify as "dessert".
The inhabitants of Halut in the Perry Rhodan universe (distant descendants of genetically engineered alien super soldiers who rebelled against their creators) are technically more extreme omnivores, but one of them taking a quick bite out of a convenient piece of rock when nothing else is immediately handy is certainly not an uncommon sight.
In Prehistoric Park, much to the annoyance of the park staff, Titanosaurs are able to consume whole trees and thatched huts, but they prefer rocks. Justified in that the rocks allow their digestive system to crush the massive quantities of fibre they consume, easing indigestion; they can't dig except by uprooting trees, so finding an appetizing rock is not as easy as one might expect.
The aurumvorax, an eight-legged wolverine-like animal that eats metals and ores, but has a special affinity for gold.
According to Spelljammer, this is actually the natural diet of tarrasques. The more familiar all-devouring, all-destroying monsters are all just homicidally insane — most planetary atmospheres don't agree with them.
Rust monsters subsist on rust, which they can create by touching any kind of metal. Their cousins, the folugubs, can liquefy crystals at a touch and feed on the result.
Some kinds of HostArmor in Splicers can be Lithovorous, which makes them easy to maintain in the field. It also makes the ammunition for any Casting Guns especially hard.
At least one kind of War Mount, the Tunnel Rat, is lithovorous, too. The fact that they spend a lot of time digging through the earth anyway means they're basically the easiest War Mount to feed every day.
Gorons in The Legend of Zelda series have been mentioned to eat mostly rocks; one Goron describes his race as the "stone-eating people from the mountain." But they don't just eat any rocks (they're stated to be starving while living in a giant cavern, after all), they can only eat the rocks in the neighboring dungeon. Presumably these guys are connoisseurs.
Yes, actually. One Goron says they've become such gourmets that other rocks may as well turn to ash in their mouths, for all the satisfaction they get from eating them.
Later games add some other mineral-based meals for Gorons, usually as a part of sidequests: one game has you delivering a rock sirloin (a hunk of rock that resembles Cartoon Meat) to a stranded Goron while another has you delivering a bowl of lava soup to a sick Biggoron. They also like to eat amber, even if it has fossilized bugs inside it.
In My Little Pony: Friendship Is Magic, Spike is an Extreme Omnivore, but seems to prefer gemstones over anything else (luckily for him, gems in that universe are extremely common and, with a few exceptions, are less valuable than fool's gold). The gemstones thing appears to extend to other dragons in the series as well.
Earthworms. However, they don't actually get nourishment from eating dirt, it's just how they travel. What they eat is decaying organic material.
Otherwise known as "dirt."
There's a disorder known as Pica that causes people to crave and eat things that aren't normal food; often, this is dirt or rocks.
Many animals have stomach-like organs known as gizzards, which lack the powerful acids that true stomachs have to break down food. For this reason, many creatures with gizzards swallow stones (known as gastroliths) to help crush the food in the gizzard. As a side-note to Harry Potter fans, this is why bezoars can be found in the stomach of a goat.
Certain minerals of a "stone-like" nature can be consumed for medicinal purposes in Chinese herbal medicine, but only in small dosages which are boiled for hours. One such mineral, Gypsum (or, in TCM: Shi Gao), can notably be purchased in large quantities from the Home Depot, as it is mostly used as drywall.
Eating small amounts of clay is a surprisingly-common habit for people in subsistence cultures, who don't receive a full daily supply of minerals from their usual diet. It's particularly common in pregnant women, who really need those minerals.
All humans, and most other animals, have a biological need to consume at least one type of naturally-occurring mineral: salt.
San Pellegrino sparkling mineral water. The bubbles are natural, a result of a mineral called calcium carbonate. This also gives it a...unique flavor. It's very popular in Europe.