'Stranger Danger' is a broad term used to teaching children about how to stay safe in interactions with people they don't know. No one just sits their child down and says "Strangers are dangerous", but are instead having an extended discussion about potential dangerous situations involving strangers. It's like saying "lol, why do people go to driving school - it doesn't teach you how to stop the car, it's DRIVING school" - It's a name used to refer to a topic.
Stranger danger usually involves teaching children how to say 'no', recognize when they are in an uncomfortable situation, and to think critically about the world around them. "Does this feel right to me?" It encourages children to ask questions and leave an uncomfortable situation, and what adults they can go to if they need help (A police officer, Someone working at the store, a bus driver, ect...).