Hamsters do exhibit cannibalistic behavior towards each other, with the main reasons being as follows:

Solitary Nature and Territorial Instincts
Hamsters are solitary animals and develop an extremely strong sense of territory once they reach adulthood. When housed together, same-sex hamsters—male ones in particular—often engage in fatal conflicts over territory, with an attack rate as high as 70%. Female hamsters, though they claim smaller territories, are more aggressive; 90% of cage-mates’ fatalities are caused by female hamsters.
Conflicts During Breeding Periods
Male hamsters remain in heat continuously, while female hamsters go into heat cyclically. When forced mating fails, the aggression of male hamsters can surge fivefold.
Pregnant female hamsters will attack males to protect their offspring, with the 20 days before giving birth being especially dangerous.
Environmental and Health Factors
When the cage area is less than 470 cm², the attack rate increases by 65%. Hunger or high-protein foods (such as mealworms) can easily trigger bloody conflicts.
Weakened individuals (sick or disabled) are seen as threats by their peers and may be attacked to death.
Preventive Measures
Hamsters must be housed one per cage, with the cage floor area being at least 120 cm × 60 cm.
During the breeding period, hamsters need to be separated immediately. Mother and offspring should not be kept together after 20 days.
Cannibalism among hamsters is mostly a manifestation of the "survival of the fittest" instinct rather than active predation. Housing them together carries extremely high risks, and separate cages are the safest option.