We get distracted in two ways, top down when an alert, notification, or emergency demands our attention and bottom up when we’re bored.
Being bored evolutionarily is something that happens to maximize our time for resource gathering. Think of a squirrel in a tree. It starts picking the tree clean of nuts. At a certain point they evaluate the benefit of picking the last X % of nuts from the current tree, vs jumping to the next tree. The factors here are: what resources/benefit am I getting here, how close is the next place to gain, how many resources are in the next place.
To simplify, we let ourselves become distracted based on what we find important and what gain we’re getting.