It is rarely one thing. The most common culprits are constant interruptions (notifications, open tabs, a nearby phone), a task that is vague or feels too big, and low physical energy from poor sleep, dehydration or working during an energy dip.
Attention is also a trainable skill that most modern habits actively erode. If you spend all day switching between apps, sustained focus feels alien. The fix is to remove the interruptions, define a concrete next step, work with your energy rather than against it, and rebuild the muscle with short focused blocks that you slowly extend.