Why is the commutator defined differently for groups and rings?
The commutator of two elements in a group is defined as $[g, h] = g^{−1}h^{−1}gh.$ In a ring, the commutator of two elements is $[a, b] = ab - ba.$
I'm asking because a ring is a (abelian) group under addition, so I would have expected it to be $[g, h] = -g-h+g+h.$
Here is a more abstract and unified approach to commutators. I could phrase this whole answer in terms of category theory (and this is probably the best way to think of it), but I won't in order to make the answer more accessible.
Let $G$ be a group. We want to make it commutative. What does that mean? We want to find a commutative group $A$ and a homomorphism $\pi : G \to A$ which is the "best" choice of a homomorphism to a commutative group. This entails in particular that $\pi(gh)=\pi(hg)$ and hence $\pi(ghg^{-1} h^{-1})=1$, i.e. the elements of the form $ghg^{-1} h^{-1}$ lie in the kernel of $\pi$. So the best choice should be: We let $G'$ be the (automatically normal) subgroup of $G$ generated by these elements, and let $A=G/G'$, and of course $\pi$ is the projection.
Now let $R$ be a ring. We want to make it commutative, i.e. we want to find a commutative ring $A$ with a "best" homomorphism $\pi : R \to A$. This entails in particular $\pi(ab)=\pi(ba)$ and hence $\pi(ab-ba)=0$. So we should define $A=R/I$, where $I$ is the ideal generated by elements of the form $ab-ba$.
In each case, commutativity was achieved by setting certain elements to the identity element for the group operation, which are therefore called commutators: They measure the failure of commutativity.
However, we are not limited to groups or rings. A very similar algebraic structure is a monoid, which is a semigroup with identity. Now given a monoid $M$, in order to find a commutative monoid $A$ equipped with a "best" homomorphism $\pi : M \to A$, we again have $\pi(ab)=\pi(ba)$, but now we are stuck: We cannot simplify this. But that's ok, we may just define $\sim$ to be the smallest congruence relation on $M$ which satisfies $ab \sim ba$. It is a bit ugly to describe this explicitly. But, being a congruence relation, we may construct a monoid $M/{\sim}$, which is commutative by construction. As you see, here we have no "commutator", but the best commutative quotient still exists.
Basically the same "commutatizing" construction works for all algebraic structures which have a binary operation in their type. For groups and rings, we are used to identify congruence relations with normal subgroups resp. ideals, and that's why $ab \sim ba$ gets "simplified" (really?) to $aba^{-1} b^{-1} \sim 1$ resp. $ab-ba \sim 0$.
The commutator of a group and a commutator of a ring, though similar, are fundamentally different, as you say. In each case, however, the commutator measures the "extent" to which two elements fail to commute. That is, given elements $a,b$, we wish to "compare" $ab$ and $ba$.
In the context of a group, we only have one operation: "multiplication". One way to compare two "values" using multiplication is to divide them; the "closer" you are to the identity, the closer the two values are. In particular, if $a$ and $b$ commute, we'd have $$ \frac{ab}{ba} = 1 $$ Where $1$ denotes the group identity here. Of course, this "division" notation is a bit ambiguous in the context of groups, since multiplication is non-commutative here. What we take to be the commutator, then, is $$ [a,b] = (ba)^{-1}(ab) = a^{-1}b^{-1}ab $$ With rings, it would be fantastic if we could reuse the same definition. However, the problem is that in a ring, we can't divide. Rings don't need to be groups under multiplication, they only need to be monoids (or semigroups, depending on definition).
We still, however, have an operation that allows us to "compare" $ab$ and $ba$, namely, subtraction. In particular, when $a$ and $b$ commute, we have $ab - ba = 0$. So, because it's the only way to "measure" the extent to which $a$ and $b$ commute, we define $$ [a,b] = ab - ba $$ in rings. It so happens that if your ring happens to allow division (that is, if you have a division ring), then it would seem that you could use both commutators. However, the group commutator works for every group, and the ring commutator works for every ring. This is why we define them the way we do.
Another perspective on this comes from considering the relationship between a Lie group and its corresponding Lie algebra. Details are at On the relationship between the commutators of a Lie group and its Lie algebra, but the upshot is that the ring commutator $[A,B]=AB-BA$ can be regarded as an infinitesimal version of the group commutator $[\alpha,\beta]=\alpha^{-1}\beta^{-1}\alpha\beta$.
In both cases, commutators measure how far the object is from being commutative.
A group is commutative when its operation is commutative.
A ring is commutative when its multiplication is commutative. (Addition in a ring is always commutative.)
Hence, the definition of commutator in each case reflects what it means to commute, as it should.