Problems with anxiety and depression occur when our emotional reactions don’t match what triggered them in the first place, leading to maladaptive ways of behaving.
For example, it makes perfect sense to run out of a burning building. It might also feel like it makes sense to run out of a room when your heart is beating quickly and your breathing is shallow and you fear you’re going to have a panic attack, but this is not accurate because ultimately you are in no real danger if you choose to stay in the room.