They have an excellent sense of smell and naturally root out buried or hidden foodstuff to eat.
That can be trained from “find and eat” to “find and indicate” the same way we train dogs to chase and catch game without immediately eating it. The difference being that more traditional, predatory companions/working animals like dogs don’t care about truffles.
Clarity edit from a couple of replies: yes, we mostly use dogs for this now, the same way we figured out how to train them on all sorts of other things. Pigs being predisposed towards truffles are why they were the TRADITIONAL rather than current choice. Sorry for any confusion.
Latest Answers