Chiral gauge theories and their applications