An itch is a built-in defence mechanism that is designed to alert your body to potential harm. It starts because a stimulus such as a bug or leaf comes into contact with your skin and rubs back and forth against it. This causes irritation and triggers fibres from your skin to send signals to your brain. Your natural reaction to this is to scratch the area to remove the irritant.
Lucy Yate, Science Museum