Well I think if you take in the point that they were teenagers and still technically kids at that point, Xander didn't really have the maturity level at that time to be the bigger person. Maturity was never a really strong point for Xander.
From the outside as viewers we sympathize with Cordelia because she was the wronged party (plus the whole "locker material" revelation, omg that was so sad.) so we can understand her being bitter to the max over it.
On the other hand, you can only beat someone to death with mean quips so many times before they will eventually quit taking it and start biting back. So while I understand Cordelia's nastiness towards him, and I understand Xander is not the perfect example of someone who acts with maturity, I think they both kind of had it coming.