When a demon gets the taste of human blood, they lose control and go berserk. They develop an insatiable need to consume human flesh. Nezuko bites down on a strong bamboo muzzle to ensure no human blood enters her mouth, intentionally or unintentionally. If she tastes human blood, she would lose the remaining human consciousness she has left and is likely to go on a rampage, attacking other beings. This would force Kamado Tanjiro and the other demon slayers to kill her. Hence, the bamboo is used as sort of gag to protect others as well as herself.