The sentence in question
He gave her a gesture while leaving the room.
is certainly grammatical.
The phrase give a gesture is not idiomatic, however, and not a spectacularly helpful description, since it doesn't include the communicative intent of the gesture. As other comments have made clear, people use gestures for all kinds of purposes, and if this is sposta be a description, it's not doing the job.
This is very much like saying
He said a sentence to her while leaving the room.
The reader's reaction to this sentence is likely to be something like
"OK, and ...?"
because it's the meaning of the sentence, or the gesture, that's likely to be important to the reader, not the physical description of the event.