In this study, abundances of the neutron-capture elements Rb, Sr, and Zr are derived, for the first time, in a sample of nearby M dwarfs. We focus on stars in the metallicity range -0.5<[Fe/H]<+0.3, an interval poorly explored for Rb abundances in previous analyses. To do this we use high-resolution, high-signal-to-noise-ratio, optical and near-infrared spectra of 57 M dwarfs observed with CARMENES. The resulting [Sr/Fe] and [Zr/Fe] ratios for most M dwarfs are almost constant at about the solar value, and are identical to those found in GK dwarfs of the same metallicity. However, for Rb we find systematic underabundances ([Rb/Fe]<0.0) by a factor two on average. Furthermore, a tendency is found for Rb-but not for other heavy elements (Sr, Zr) -to increase with increasing metallicity such that [Rb/Fe]>0.0 is attained at metallicities higher than solar. These are surprising results, never seen for any other heavy element, and are difficult to understand within the formulation of the s- and r-processes, both contributing sources to the Galactic Rb abundance. We discuss the reliability of these findings for Rb in terms of non-LTE effects, stellar activity, or an anomalous Rb abundance in the Solar System, but no explanation is found. We then interpret the full observed [Rb/Fe] versus [Fe/H] trend within the framework of theoretical predictions from state-of-the-art chemical evolution models for heavy elements, but a simple interpretation is not found either. In particular, the possible secondary behaviour of the [Rb/Fe] ratio at super-solar metallicities would require a much larger production of Rb than currently predicted in AGB stars through the s-process without overproducing Sr and Zr.