Defendant is normally used as the opposing party to a plaintiff, in a civil cause of action. It also refers to the accused in a criminal matter.
Respondent is normally used as the responding party to an applicant, in motions, in certain statutory relief, relief based in judicial review, etc. It is also used to refer to the opposing party to petitioners in various statutory and equitable matters (and in some jurisdictions, there is little to no distinction between petitions and applications).
Before administrative adjudicative tribunals and in alternative dispute processes, respondent is often the party that is not the claimant.
A plaintiff or defendant may also either be an applicant or respondent on various motions at different times throughout the litigation.
Respondent also refers to the non-appellant party or parties on appeal.
There are likely other contexts that I am missing. For more, look to the rules, practice directives, or forms for the particular forum and process you are wondering about.