Higher maternal vitamin D concentration during pregnancy is associated with better child mental health. Negative affectivity, an early-emerging temperamental trait, indicates an increased risk of psychopathology. We investigated if maternal early/mid-pregnancy 25-hydroxyvitamin D (25(OH)D) and neonatal cord blood 25(OH)D concentrations are associated with Negative affectivity in infancy. We studied term-born infants from the vitamin D Intervention in Infants study (VIDI, n = 777, follow-up rate 80%, Finland), and the Generation R Study (n = 1505, follow-up rate 40%, Netherlands). We measured maternal serum 25(OH)D at 6–27 weeks (VIDI) or 18–25 weeks (Generation R) of pregnancy, and cord blood 25(OH)D at birth (both cohorts). Caregivers rated infant Negative affectivity at 11.7 months (VIDI) or 6.5 months (Generation R) using the Revised Infant Behavior Questionnaire. Using linear regression, we tested associations between 25(OH)D and Negative affectivity adjusted for infant age, sex, season of 25(OH)D measurement, maternal age, education, smoking, and body-mass-index. Per 10 nmol/l increase in maternal early/mid-pregnancy 25(OH)D, infant Negative affectivity decreased by 0.02 standard deviations (95% confidence interval [CI] − 0.06, − 0.004) in VIDI, and 0.03 standard deviations (95% CI − 0.03, − 0.01) in Generation R. Cord blood 25(OH)D was associated with Negative affectivity in Generation R (− 0.03, 95% CI − 0.05, − 0.01), but not VIDI (0.00, 95% CI − 0.02, 0.02). Lower maternal 25(OH)D concentrations were consistently associated with higher infant Negative affectivity, while associations between cord blood 25(OH)D concentrations and Negative affectivity were less clear. Maternal vitamin D status during early- and mid-pregnancy may be linked with early-emerging differences in offspring behavior.