The XXY chromosomal pattern (Klinefelter syndrome, KS) has been associated with specific effects on physical, neurobiological, endocrinological and psychological development. This study was focused on the described risk for autism in KS, and the cognitive mechanisms that mediate this risk. Our aim was to assess whether autistic features in KS result from impairments in executive functioning, more specifically difficulties in cognitive flexibility. In total, 71 boys and men with KS and 61 non-clinical controls participated in the study. Autistic features were assessed using the Autism-spectrum Quotient (AQ). Mental flexibility was measured using the Wisconsin Card Sorting Test (WCST).The level of autism traits was significantly increased in the KS group, the effect size for total AQ score was 1.6. The KS group also showed significantly more difficulties in cognitive flexibility, as indicated by and increased number of perseverative (but not non-perseverative) errors in the WCST. This effect was independent of intellectual functioning, age or testosterone supplements. Within the KS group, the number of perseverative errors was significantly (positively) correlated with total AQ score. Our findings suggest that KS can be associated with dysfunctions in mental flexibility, and that individuals with more mental flexibility problems also have more autism traits. This insight is relevant for diagnosis, prevention and treatment of severe problems in individuals with KS. Implications also extend beyond this specific syndrome. As executive dysfunctions in KS have also been linked to ADHD symptoms and thought disorder, this could be a shared mechanism contributing to overlap in symptoms and comorbidity between different psychiatric conditions.