why im using NVIDIA GeForce 940M 4GB lag when i playing gta5

Could you please supply some more information about your system to enable folks to help you?

From your Windows Start button, right click on This PC (assuming Windows 10) and the CPU and Memory (RAM) details are in there.
 


Again, what resolution are you playing at and what frames per second are you getting? Nobody can diagnose anything with just your subjective feel of lagging to go on.
 
Try setting nvidia control panel AND windows power to maximum (instead of balanced or whatever it's set at).

Go into systray before starting game and close anything you dont have to have.

Would get another 4gb of ram if you have a free slot.