This idiom comes from the Zuozhuan (
左传), a historical text from around 400 BC. It was originally political advice: when you defeat an enemy, make sure they can't come back. In Chinese martial arts novels, villains love saying
斩草除根 before attempting to wipe out a hero's family.