Today my boss came by my desk and told to me
"stop whacking off, when will phase 2 of the project be completed?"
What does "stop whacking off" mean? I did not know how to respond.
What is an appropriate response?
Usually, if you don't know the meaning of a sentence, I would recommend a good dictionary, like Merriam–Webster's, or dictionary.com. There is an alternative dictionary, called "Urban Dictionary" where all of the definitions come from online users, and so it tends to get a lot of rude and slang words. In this case, this site has a great definition for whacking-off:
So your boss was rudely saying that what you were being unproductive instead of working, as if you were masturbating at work. Although to be fair, masturbating at work is far worse than merely unproductive, so in this case it's probably a lot closer to saying you were slacking off, which just means not working as hard as you should be (it even rhymes!).
The appropriate response probably depends on whether or not you're offended by this remark. If you're not offended by his rough language, the appropriate response is probably to work harder. If you are, that might be a better question on the workplace.se than here.