The comorbidity of depression and anxiety has long been recognized, but the cognitive mechanisms shared by and distinguishing the two remain poorly understood. This study used reinforcement learning as a unified computational framework and a probabilistic instrumental learning task in two experiments (n = 190 and n = 361). Depression traits were negatively associated with learning rates, whereas anxiety traits showed the opposite pattern. Transdiagnostic latent factors further revealed that somatic symptoms and anhedonia primarily contributed to the negative association with depression, while cognitive symptoms and negative affect contributed to the positive association with anxiety. The dissociation may reflect a trade-off in which excessive internal focus reduces the capacity for external information processing, illustrating how a transdiagnostic computational approach can identify distinct cognitive profiles of depression and anxiety.