Thanks a lot. I made up the example as I wondered whether or not I should use a comma before the phrase "that is why" in the middle of a sentence. Maybe the example is not the best. Is there a general rule for using or leaving out the comma before the phrase "that is why"? Thanks a lot and sorry for the confusing example.
The basic rules of grammar and comma use always apply. In the sentence you cited you have two independent clauses linked by a comma - which is a comma splice (a kind of run-on sentence). So Cenzontle is absolutely right.
But look at:
I wanted to be early for my flight, so I drove. Ironically, that's why I ended up being late - there was a massive traffic jam on the highway.
There is nothing special about "that is why", except that (1) it begins a clause, and (2) it refers to the preceding clause.
So there are two complete clauses. If you join two "independent" clauses with a comma, that's called a '"comma splice", and it's usually considered wrong.
When two clauses are joined by "and", I think it's a good idea to put a comma before "and" (but some writers don't follow this rule, especially when the clauses are short).
The semicolon ( ; ) is accepted for joining clauses that are closely related in meaning, such as by cause and effect.
The dash (—) in this context is less formal than the semicolon.