Overthinking can be a symptom of anxiety. For example, if we look at someone who has a job interview and they have thought of 10 possibilities that could come out of it. Only a few of the options are likely to be realistic. The rest are obscure and not likely to happen.
Worrying about the unrealistic scenarios and coming up with them in high numbers, is a defence mechanism common to people with anxiety. It's to protect and prepare for any scenario, no matter how absurd it is.
Of course, this isn't always the case. It can be situation dependent for people.