Aristotle (384-322BC) did wonder, and arrived at the following definition: "A tragedy is the imitation of an action that is serious ... with incidents arousing pity and fear, in order to accomplish the catharsis of such emotions." He was out to disprove the view of the most famous philosopher of antiquity, who believed that going to the theatre was a most pernicious way to pass the time. Plato had argued in The Republic that poets should be exiled from the ideal state because they aroused emotions which flouted the dictates of reason. Aristotle rejoined that, although watching tragedies raised emotions, it also purged them. An audience would come away from Oedipus humbled, keen to be better and wiser.
We are moved by tragedies principally because we think, "What if I had been in that situation?", and they terrify us because we realise we would not necessarily have come out of it better than the heroes and heroines on stage. We are affected by tragedies because we identify with these figures, despite the fact that we live in very different times. Their stories, however far-fetched, are a possibility for us too. That's why Aristotle argued that a good tragedy should not have an entirely good or bad hero, but rather someone "whose misfortune is brought upon him not by vice and depravity but by some error of judgment".
We might make that kind of error, if life were to test us as harshly as it has tests the characters. We, too, could stab the wrong people, or realise too late that we ruined what we cared about most, or overlooked the people who loved us. We are all in danger of doing a Hamlet or an Othello. Perhaps we already have made some pretty serious errors, in which case tragedy invites us to feel a kind of sympathy for our flawed selves (and a generosity towards the flaws of others).
Most of the time, we don't bring this empathy to bear on our own or others' stories. We look at them as Shakespeare led us to look at Rosencrantz and Guildenstern rather than Hamlet. It took some four centuries for Tom Stoppard to demonstrate that these two men were also worthy of the complex consideration that tragic heroes and heroines are subjected to. Tragedy trains us to be more understanding of human frailty - and that's why Aristotle seemed to believe that attending regular performances where people killed their fathers and married their mothers was not a bad way of spending time.