Why did O'connor make Grandmother a bad person and The Misfit a good person at the end of the story "A Good Man is Hard to Find"?
Your question reflects some confusion about what actually happens in the end of the story. To start with, Grandmother is a complaining, unsympathetic character who causes trouble for herself and others through her persistent ways: "she was seizing at every chance to change Bailey's mind." The Misfit is a criminal who is a murderer and who has escaped from prison. These are both, in their own ways and to their own degrees, bad people.
The end of the story has a surprise twist to it that is is hinted at earlier on: Grandmother is actually The Misfit's mother; The Misfit is actually Grandmother's son. She raised him and he knows her; he knows what she is like.
In the end, Grandmother flatters and compliments The Misfit so that he will not kill her. This isn't exactly bad behavior on Grandmother's part but it certainly lacks dignity and integrity. Also in the end, The Misfit murders, or orders the murders of, Grandmother's entire family (as she stands by chatting with Misfit ...). This is most assuredly and clearly bad behavior.
The incident that is giving you the wrong impression that O'Connor made Grandmother bad and Misfit good is the exchange between them just before and just after Misfit fires his gun three times to end Grandmother's life. Firstly, she says, "Jesus. Jesus." To her own ears, her utterances sounded like swearing because of the repetition. Actually her words were the choked off prayer and blessing that meant to express, "Jesus will help you"--but didn't quite make it. This is actually a good turn that she takes in the end because she lets go of her selfishness and cares about and trys to reach out to help someone else.
Secondly, he says "She would have been a good woman ...." He statement has a positive phrase in it, good woman, so his remark may sound good. Actually what he means is that she needed someone with every moment of her life to threaten her with death so that she wouldn't be the selfish, nagging, trouble-causing unpleasant person she really was. This is a bad, unkind remark (about the mother he just murdered) following a bad action. Misfit is portrayed as thoroughly bad in the end.