what is the word for when someone has a bad experience with a person, then they use this logic and apply it to the entire world

The term for this phenomenon is "overgeneralization."

define it

Overgeneralization is a cognitive distortion where someone interprets a single negative event as a never-ending pattern of defeat or failure. They tend to apply one experience to a broad range of situations or people, leading to an irrational belief that similar negative outcomes will occur in the future.