Understanding nanoscale tribology and adsorption is of fundamental importance for developing novel nanomaterials with desired (electro)mechanical properties. To do so, one of the central issues is to uncover the role of the nonlocal/local electrons and the metallic/ionic bonding in the friction and adsorption at nanoscale. We use density-functional theory including many-body dispersion forces to study the nanofriction and adsorption of graphene, $h$-BN, and CNTs. By studying the interlayer sliding, the competition of rolling and sliding, and the adsorption properties of these nanomaterials, we find that the nonlocal/local electrons and metallic/ionic bonding of nanomaterials yield distinct friction and adsorption properties at nanoscale, which are essentially determined by the collective quantum charge-density fluctuations. These findings not only explain the available experimental observations, but also are helpful to establish a comprehensive picture of friction and adsorption at nanoscale.