"I wish the earthquake didn't happen" will sound incorrect to native speakers of English, because did/do is not used as a subjunctive verb in English, but had is very commonly used for subjunctive statements. This may be confusing, because had is also used for non-subjunctive statements (the past tense of have): "I had not considered leaving before the earthquake hit." which could also correctly be said as: "I did not consider leaving before the earthquake hit."
"I'm glad the earthquake didn't happen" is valid, because it would express a matter of fact (if that were true). But since the earthquake DID happen, then any reference to it not happening is hypothetical or unreal, which is what the subjunctive mood conveys: what might have been.
One might also correctly say:
- "I wish I had left town before the earthquake" - because one did NOT in fact leave
- "I'm glad I did leave town before the earthquake" - because one DID in fact leave
- "I wish I hadn't stayed in town on that day"
- "It's good that I didn't stay in town"
- "I wish the earthquake would not have happened" - using a modal verb would to say the same thing
Notice the pattern: "I wish..." always employs the subjunctive mood, because it is speaking of a hypothetical or imaginary situation that is not real or true right now, especially speaking of the past.
In summary: did/didn't refers to actual, real events or matters of fact, and had/hadn't often refers to potential but unreal events which are desired or hypothetical.