Why are parents said to have the right to teach their children whatever they
I don't know of any society where parents can teach their children whatever they want without regard to laws and social norms. With respect to laws, for example, a parent could not teach a child that it was okay to act out sexually in a way that the law would regard as involving incestuous sexual abuse. And, similarly, with respect to social norms I think that most people would say that parents have no right to teach their children a virulent racism that promoted the children to treat schoolmates horribly.
Both of the examples I gave involved teaching extreme thought that led to unacceptable action, and these cases show that exist significant limitations to parents' rights to teach their children as they see fit. Are there cases where there are limits on what parents could teach their children to believe even when the children do not act on those beliefs? The incest case, I think, shows that there are strong social and perhaps legal limits on teaching "mere" thoughts -- the incest taboo is so strong that if others were to find out that parents were teaching their children that incest were okay would face social and perhaps legal sanction even if no incestuous behavior occurred.
So, the taboo case shows that even the most pluralistic and free societies place limits on what parents can teach their children. Of course, many societies reject pluralism or support limited freedoms (or both) and in those societies parents face many more limitations.
All that said, does there exist a philosophical theory according to which parents have a right to teach their children whatever they want? If so, perhaps the existence of the various limitations I've described should be understood as lamentable cases where existing societies fail to support rights to which parents are entitled. There are, of course, robust philosophical defenses of pluralism and autonomy that would support granting broad latitude to parents to teach their children unpopular or unpleasant things, and some societies embrace pluralism strongly enough that parents do in fact enjoy that sort of latitude (consider, for example, the way that the home schooling movement in the United States supports this). However, those philosophical theories and justifications are of course disputable and disputed and I think that even those who defend them would admit limitations of the sort I describe in the first paragraph, above.