Symbolism, Imagery, Allegory
Throughout the novel, the Buendía family lives under the warning/curse of Úrsula's mother: that a baby born from incest will have the tail of a pig. For a while, this seems like a merely metaphorical threat. We see the Buendía family becoming more and more degenerate with each passing generation, and we think about the pig-tailed baby phenomenon as just a pithy turn of phrase to describe how inwardly focused and generally not-quite-right-in-the-head these people are.
But lo and behold, the prediction actually comes true when the last Buendía, born from yet another episode of incest, really does have the tail of a pig. By this time, we've reached modernity, so the parents think a small operation will correct the problem. But of course the curse is real, and the baby is the indicator that the Buendía family has become rotten to the core. So the child comes to the horrific end of being eaten alive by ants. And with that, the family is wiped away completely.