As the size of the material decreases to the nanoscale, the distinction between batteries and electrochemical capacitors becomes obscured. Here, a first-principles approach is developed to calculate electrochemical capacitance of nanomaterials. Using TiO2 anatase nanosheets interfaced with lithium ion-containing electrolytes as an example, we reveal a microscopic mechanism for lithium intercalation in this system. We demonstrate that a TiO2 nanosheet is a hybrid of super-capacitor and battery, possessing characteristics of both depending on electrode potential. At positive electrode potential above 2.2 V versus Li/Li+, the system behaves as capacitor with the formation of electric double layers at the surface. As the electrode potential decreases below the threshold, lithium intercalation into the interior takes place, assisted by the surface electric dipole field. Our findings provide a coherent picture of how a transition from pure capacitors to batteries or pseudocapacitors occurs in these nanostructured materials.