Once upon a time, sage Agastya was along the banks of the river Kaveri. He was known for many famous acts and deeds such as devising the rules of Tamil grammar. So, Kaveri too knew about him. But when she saw him, he was shorter in height than what she had expected and so without thinking twice, she laughed arrogantly. Sage Agastya was livid with anger and taking his kamandal, he sucked the entire Kaveri river into it. All this was witnessed by another sage who was hiding behind a tree.
The sage went and told this to Ganesha. He said that without Kaveri, the people of South India would suffer and so it must be released at once. Ganesha said he would intervene and at once he descended to earth. He came in front of sage Agastya and saw that he was deeply engrossed in his meditation. The kamandal was beside him and Ganesha, taking the form of a crow, knocked the kamandal over. Kaveri was released and the people of South India received water once again. Ganesha then took the form of a boy.
When sage Agastya concluded his penance, he saw that the kamandal was lying down and the river Kaveri was flowing normally as if nothing had happened. He then saw a boy nearby and immediately he grabbed his hand. In a fit of rage, he raised his hand on the boy and asked menacingly if he was the one who spilled the kamandal. Without uttering a word, the boy revealed himself to be Lord Ganesha. Sage Agastya immediately lowered his hand and took a few steps back. He asked for forgiveness, but in response Ganesha chuckled and said that he would be happy to get knocked in the head by such a great sage. Sage Agastya felt shameful and so he knocked his own head on both sides with his hands. Ganesha was impressed by this act and he said that henceforth whoever should do this act and worship him, will be blessed with wisdom.