NaHCO3 or sodium hydrogen carbonate is actually an amphiprotic substance - that is, it can act as an acid or a base by donating or accepting a proton according to Bronsted Lowry's theory.
This is because of the hydrogen carbonate ion which can either accept or donate a proton, as you have said...