Even if you are forced to be good (e.g., out of fear of punishment), how is that good for the individual in question? An example is the main protagonist in the novel 1984, Winston Smith. This also raises the question what is being good. I am not claiming to have any answers but I find the whole idea of ‘good’ interesting. Here is one take, article title: “Why You Should Stop Being a Good Person” at psychcentral(dot)com some interesting ideas there.
Sounds like a movie plot.