They are both correct grammatically, but they have slightly different connotations. This is why you see both in common use, since there are different times when you'd use each phrase.
Who is the better person, A or B?
If you use the definite article the, the implication is there is one particular situation where both A and B can choose to act better or worse, and you're wondering who will be the person to be better behaved at this one particular time. For example, A and B are both seated on a crowded bus and an elderly woman gets on; you wonder who will be the better person by offering her a seat.
Who is a better person, A or B?
If you use the indefinite article a, the implication is that your asking about whether A or B is a better person overall, and not just at one particular point in time. For example, you are asked whether A or B is your personal hero; you would (hopefully!) choose the person who is a better person in general, not just at one particular time.