Why does capsaicin irritate mammals and also kill fungi? Are the two related?
Recent study has shown that capsaicin indeed has antimicrobial properties. For example, see this article:


  Two pungent compounds found in Capsicum species (capsaicin and dihydrocapsaicin) were also tested for their anti-microbial effects. The plain and heated extracts were found to exhibit varying degrees of inhibition against Bacillus cereus, Bacillus subtilis, Clostridium sporogenes, Clostridium tetani, and Streptococcus pyogenes.


In one of the attempts to study its mechanism, a study on yeasts suggested that it works in following ways:


Detoxification of capsaicin by a PDR-type ABC
superfamily of multi-drug resistance transporters
Osmotic stress response and damages in membrane
structure caused by the capsaicin treatment
Genotoxicity of capsaicin to yeast cells
The effects of the deletions of the genes those were
induced by the capsaicin treatment
Mechanism of capsaicin in the growth inhbition to
yeast cells:

The DNA microarray analysis of antimicrobial
mechanism of capsaicin shows that capsaicin induced
an osmotic stress element, the key genes for membrane biosynthesis, and the PDR network and repressed the genes for ribosomal components
and cellular growth. The growth characteristics of
deletion strains suggest that PDR5 is important for
the resistance to capsaicin. These observations that
the PDR network may pump out capsaicin from cells
are the first findings. The contribution of the PDR
network also suggests that capsaicin enters to the
cells and capsaicin functions as a toxic substance to
the yeast cells. This toxicity is possibly to the
mebrane structure and/or as osmotic stress.

Full article (PDF) here.


Though in mammals, its mechanism of action is quite different; it acts on ion channels to give a burning sensation. See this article:


  The burning and painful sensations associated with capsaicin result from its chemical interaction with sensory neurons. Capsaicin, as a member of the vanilloid family, binds to a receptor called the vanilloid receptor subtype 1 (TRPV1). TRPV1, which can also be stimulated with heat, protons and physical abrasion, permits cations to pass through the cell membrane when activated. The resulting depolarization of the neuron stimulates it to signal the brain. By binding to the TRPV1 receptor, the capsaicin molecule produces similar sensations to those of excessive heat or abrasive damage, explaining why the spiciness of capsaicin is described as a burning sensation.


However, it is toxic for mammals too. Capsaicin is a highly irritant material requiring proper protective goggles, respirators, and proper hazardous material-handling procedures. Capsaicin takes effect upon skin contact (irritant, sensitizer), eye contact (irritant), ingestion, and inhalation (lung irritant, lung sensitizer). The LD50 in mice is 47.2 mg/kg.

Though its mechanisms are different, it performs quite similar functions: protecting the plant from predators and infections i.e. a defense system.

It seems like quite a coincidence, unless capsaicin has some general destructive properties.

It is neither a coincidence nor capsaicin has general destructive properties. In fact, capsaicin is being used as an analgesic too. See this article:


  Capsaicin is a chili pepper extract with analgesic properties. Capsaicin is a neuropeptide releasing agent selective for primary sensory peripheral neurons. Used topically, capsaicin aids in controlling peripheral nerve pain. This agent has been used experimentally to manipulate substance P and other tachykinins. In addition, capsaicin may be useful in controlling chemotherapy- and radiotherapy-induced mucositis.


Its mode of action is, seemingly, somewhat similar. See this:


  The mechanism of action of topical capsaicin has been ascribed to depletion of substance P. However, experimental and clinical studies show that depletion of substance P from
  nociceptors is only a correlate of capsaicin treatment and has little, if any, causative role in pain relief. Rather, topical capsaicin acts in the skin to attenuate cutaneous hypersensitivity and reduce pain by a process best described as ‘defunctionalization’ of nociceptor fibres. Defunctionalization is due to a number of effects that include temporary loss of membrane potential, inability to transport neurotrophic factors leading to altered phenotype, and reversible retraction of epidermal and dermal nerve fibre terminals. Peripheral neuropathic hypersensitivity is mediated by diverse mechanisms, including altered expression of the
  capsaicin receptor TRPV1 or other key ion channels in affected or intact adjacent peripheral nociceptive nerve fibres, aberrant re-innervation, and collateral sprouting, all of which are
  defunctionalized by topical capsaicin. Evidence suggests that the utility of topical capsaicin may extend beyond painful peripheral neuropathies.
  
  


(P.S. substance P is a neuropeptide, a potent vasodilator &amp; iniates expression of almost all known cytokines.)

Pay attention to the last line 'utility of topical capsaicin may extendbeyond painful peripheral neuropathies.' i.e. capsaicin may have more effects on body than known!