Can we use "what do you do?" to mean "what activity are you engaged in at the moment?" And not asking about someone's job. My teacher once used it not to mean asking my classmate's job. Was my teacher correct? Can we also use "how do you do?" to mean "how someone is doing something?" like cooking a meal, rather than an expression used in greetings?
The correct way to say 'What activity are you engaged in at the moment' would be:
What are you doing (right now)?
This would be correct to ask someone what activity they are performing right now - the present continuous. Saying "what do you do" is not correct, unless you are talking about occupation, which is irrelevant.
Secondly, if you are asking how to perform an action, you would use:
How do you do it/that?
How do you cook pasta?
You use the phrase "How do you " + the action" If you just want to ask about the action in question, using 'it' is fine.