Autoimmune diseases occur when the immune system mistakenly targets and attacks healthy cells and tissues in the body.