Dear Anon, I am sorry your brother had to go through this traumatic experience. Hospitals are not a favorite of mine either but they are a necessary evil. I think your brother needs to evaluate the consequences of his desire to leave the hospital. He is a liability right now to those who are caring for him, but I do not think there is a legal recourse to keep him against his will unless he is not mentally capable of making a decision. If he insists on leaving, the hospital legal team will draft the necessary paperwork that will free them from any legal responsibility. It is very common and this "against medical advice" document will be kept in file by the hospital.
I think your brother's doctor needs to have a "tough talk" with your brother and let him see the medical consequences of his behavior not to those who are caring for him, but to his own wellbeing. Until the infection is treated, I doubt the doctor will want to remove the appendix. Five days are not long enough for a serious rupture of the appendix, your brother was lucky that he did not die as a consequence of this. Being septic is not to be taken lightly. Unless he is on a suicidal path.