For example, say you have several subdomains, like www.mydomain.com, ftp.mydomain.com, mail.mydomain.com etc and you want these sub domains to point to your main domain name mydomain.com. Instead of creating A records for each sub-domain and binding it to the IP address of your domain you can create CNAME records.
If domain.com points to 18.104.22.168 and you set up www.domain.com as a CNAME of domain.com – www.domain.com will now also point to 22.214.171.124
Why use CNAME records?
It is quite common to find that everything you have related to a domain is hosted in the same place – The website, mail, localhost, webmail etc will all use the same IP.
You could set up a specific record for each of these things, but if they ever changed every single one would need updating separately. With CNAME’s you would only need to update the original record as the rest would draw their information from that one record.