There are 4 different “types” of cannibalism. The most common in the animal world is Sexual Cannibalism, in the female of a species mates and then eats the male of the same species. The next is size structured, in which the strongest and the biggest will eat the weakest and smallest. After that would be cannibalistic infanticide, which is when the mother will eat the weakest of her young. Last is Intrauterine cannibalism which takes place in the womb. It’s when strong embryos will “eat” the weaker for nourishment.
This could have a number of different reasons. Sexual Cannibalism’s reason could be to make sure that each creature only has one mate. Because the female wants only he r children to be the strongest so by mating with the strongest male and then eating him, she insures that. cannibalistic infanticide could have a lot of reasons. One could be to make sure that there are no “flaws” in the species, but eating the weakest or “flawed” baby. It could also just be another way of getting food. If the mother eats her flawed weak child, then it will give her the nutrition she will need to feed the rest of her young.