There is an extreme number of ant species, each with a unique characteristic. In the case of carpenter ants, they are famous for their strange defence mechanism.
Some species of carpenter ants, such as the Camponotus saundersi, have warrior ants with very large mandibular glands (many times greater than normal ants). When in a battle it judges that it has no chance of winning, the ant rapidly contracts its abdominal muscles to build pressure. When sufficient pressure is reached within the mandibular glands, it explodes violently, shattering the ant in the process. The glands are filled with a sticky, toxic fluid, which is spread all around where the ant used to be, ensnaring the foes. The inflicted enemies are killed by the poison.
This is the reason why they are sometimes referred to as exploding ants.
It is a bold, yet fearsome sacrifice for the greater good.