DNS or Domain Name System is like internet phonebook. Humans identify things people places by names whereas computers only know numbers. Each and every URL you type for example, you are first directed to the DNS server which searches for the correct Ip address of the url or domain name that you have typed. Usually your ISP provides the DNS servers, thereby monitoring your activity on web. The process is complex so all you need to know is that DNS server is like a phonebook u search for names to actually contact a specific address.
When u are using vpn or tor network, What happens is, the name or url or domain names that you are searching is not directly directed to your ISP instead it uses some anonymous DNS servers. All the traffic is channeled through a more secure pipelines. It hides your activity from the ISP. Sometimes the vpn forgets or ignores the fact that that you are on a anonymous networking and uses the same DNS servers provided by your ISP , instead of channeling through the other private DNS servers. It shows diverting data through different servers but first step is pretty much same exposing your activity to your ISP.
When you surf web through tor or vpn if a request is send to the DNS server directly from the user other than vpn tunnel or tor proxy you may not find any difference. This is a simple flaw in the system that can deal a lot of damage to your anonymity. This is done by the application to reduce the dns lookup time. Since the DNS server logs all the details, you are not anonymous anymore.
dns leak
DNS or information leak is caused mainly by slow speed. When the website you are searching takes too much time to load on a specific VPN the website directs the data to the old server ie, your ISP. This is used by some malicious website for gathering your activity or information. DNS leak may cause small scale or little harm to the normal person using VPN, but when it comes to the a website holder or to a person who is doing a serious stuff on network, the DNS leak could be the worst thing happening to him.
This is a very serious issue for a hacker. Even if you have tor installed and you are using proxychains DNS leak may occur. Anonymity can be compromised by the DNS servers since most of them log the activities you could be caught any time. Major cyber forensic agencies use this method is used to unmask tor users.