I could be wrong, but I'm guessing it's because he likes the sound it makes. Parrots love making noise after all. Do you react to him when he does it? If you do, then there's a second reason. He's learned that if he taps his beak on something, he a: gets to make a funny noise, and b: he gets your attention

(the noise part applies to the table + perch I imagine, the people thing is probably more the 'attention' part of things)
I'm assuming he's healthy - nothing wrong with his beak or anything. If he's damaging his beak by doing this, or in any sign of distress whilst doing it I'd suggest consulting an avian vet about it, but provided he's healthy he's likely just found a fun game to play.