CARMENES is a spectrograph for radial velocity surveys of M dwarfs with the aim of detecting Earth-mass planets orbiting in the habitable zones of their host stars. To ensure an optimal use of the CARMENES Guaranteed Time Observations, in this paper we investigate the correlation of activity and rotation for approximately 2200 M dwarfs, ranging in spectral type from M0.0 V to M9.0 V. We present new high-resolution spectroscopic observations with FEROS, CAFE, and HRS of approximately 500 M dwarfs. For each new observation, we determined its radial velocity and measured its Halpha activity index and its rotation velocity. Additionally, we have multiple observations of many stars to investigate if there are any radial velocity variations due to multiplicity. The results of our survey confirm that early-M dwarfs are Halpha inactive with low rotational velocities and that late-M dwarfs are Halpha active with very high rotational velocities. The results of this high-resolution analysis comprise the most extensive catalogue of rotation and activity in M dwarfs currently available.