Hello Mohamed lemine Maouloud,
Thanks for your question.
VMs are charged based on the time they are running, not based on the traffic or usage. What do I mean by this: Basically, you will be charged when the machine is running whether it is being used or not. To save costs, when you are not using the machine you may choose to shut it down. You can also choose to set Autoshutdown Times.
To shutdown a VM, simply go to the resource and click stop. This will power down the VM. Example in the screenshot below.

Also do note that there some other costs which come into play, some even when the VM is stopped which include: Disks: Azure managed disk types; Egress costs; IP addresses etc.
To get an estimated outlook for what your costs will be like you can use the the pricing calculator. See https://azure.microsoft.com/en-us/pricing/calculator/
Regards,
Abiola
You can mark it 'Accept Answer' and upvote if this helped.