the action of reprimanding or warning someone
Maybe by wagging their finger it is to warn the opponent of what is to come. To reprimand is to send a formal disapproval, which could tie into the move itself. I think the more likely explanation would be the former.
Edit: Let's break out the Bulbapedia definitions, ooh yeah
(XYORAS) The user waggles a finger and stimulates its brain into randomly using nearly any move
This pretty clearly says your answer right thar. By wagging their finger, they simply "stimulate" their mind into using a random move. Maybe wagging the finger is a sort of meditation that allows the user to select any move. Most other definitions state this too, so it seems this is a pretty solid explanation.
TL;DR: Wagging the finger allows the user to stimulate their mind into using a random move.
Hope I helped