Hi I.,
I totally understand the anxiousness that you are feeling about your son. Getting this far through high school, and then blowing everything because he doesn't "like" his teacher? Can there be a more irritating thing for a senior to do to his parents?
But here's the bad news: there's nothing you can do about it. He's stakes his claim, and he is the one who will feel the pain when he can't graduate.
I talk with parents about this very kind of issue all the time. And here's what you need to do: Let it be his decision. Stop the groundings. Tell him he is old enough that he should and does control his own future. If he wants to graduate, he needs to make sure he passes this class. Tell him you're happy to help him do that if you can - hire a tutor to get him back up to speed, help carve out a study time, sit with him while he groans through the homework. But also let him know that you know you can't control his behavior, and you can't pass the class for him. Then follow through on what you said, and let him pass or fail on his own.
Hopefully he will surprise you.