What if I get assigned to teach topic I know nothing about? Do I have any discretion in what I teach?
Does a faculty member have any discretion in what he/she teaches?


Informally/unofficially: yes, they should have some say in it -- it would be weird for them not to be at least asked about their preferences. Formally/officially: how could they?  If five or ten or thirty or one hundred faculty members each insist that they must teach Y and/or cannot teach X then with very high probability there will be no way to make everyone happy.  Scheduling classes for a university department is a huge pain in the butt no matter what.  (I have never done it myself and would never do it...because it's a huge pain in the butt.  However, my current job of Graduate Coordinator is laterally adjacent to this position and close enough for me to see how difficult it is.)  If you don't give department figures at least some amount of authority over the faculty members on matters pertaining to the department as a whole, then there is an ever present threat of devolving into anarchy.

More crisply: be careful.  Outright refusing to do one of their core job responsibilities is the best way for a tenured faculty member to get in serious trouble, up to and including getting fired.  Based on my own practical experience, it would be a bit over the top for someone to get fired after having pulled this once, but the point is that you'd be standing on shaky ground.  Moreover, outright refusal is not a very helpful position:  


  both for my own sake and the sake of the students. 


I just said that doing this is probably not in your own best interest.  Moreover, how is it in the interest of the students?  If you really just refuse, then what happens?  I guess the chair books you to teach the class anyway and you don't show up...this is not helping anyone.

So what should you do?  Talk further to the chair and other faculty.  The chair is trying to solve an administrative problem: find someone to teach X.  As with most academic administrators, he is doing it under severe constraints: apparently no one else has an open teaching slot.  So he has found the best "local solution" to the problem: assign Professor Fixee to do it.  You should have at least one in-person conversation with the chair and go over the following two points:

1) Help him understand why his proposed solution is a bad one.

He doesn't seem to be looking at the fact that you have no knowledge of subject X whatsoever.  Maybe he thinks you're exaggerating to get out of an undesirable teaching assignment.  You have to let him know the truth and explore some of the implications of this with him.  (By the way, could it be that you are not actually uniquely unqualified to teach subject X -- maybe nobody else knows any more than you?  Maybe their one expert in subject X left suddenly?  It's possible...)

2) Help him "widen the problem-solving window" to include other solutions, and take on some of the effort in solving the problem yourself.

Let's assume you are literally the worst person in the department to teach subject X.  So who is actually more qualified to teach it?  (You do the work in figuring that out.)  Okay, so why are these people not teaching it -- presumably they are already loaded up with teaching assignments or other professional obligations.  Can you arrange a swap with one of these faculty members?  If so, do it and present that to the chair as a solution.

TL;DR: If you go to an administrative figure and say "Sorry, what you've asked me to do just won't work; please fix it," their answer is much more likely to be negative than if you say, "What you've asked me to do has some serious drawbacks; I'd like to propose that we do this instead."  In my experience when two faculty members come to the relevant faculty administrator and say "We'd like to swap classes X and Y" the answer is usually yes.  Why not?  It creates no new problems for them to solve.