Overthinking has more than one name in clinical language, and the differences matter. These words separate the loops that face the future from the ones that face the past.
Overthinking is the everyday word for what clinicians split into two loops. Rumination faces backward, replaying what already happened, and is most tied to depression. Worry faces forward, bracing for what might, and is most tied to anxiety. Both feel productive and neither resolves.
Several other words describe the shapes these loops take. Catastrophizing jumps to the worst case, intrusive thoughts are the unwanted thoughts the loops latch onto, and cognitive distortion is the broader category these patterns belong to. When the loop drives a behavior meant to relieve it, that behavior is a compulsion.
The way out usually involves seeing the pattern clearly first. Cognitive restructuring is one of the core techniques for changing it.