iam unable to connect through remote desktop, but through team viewer i can connect

Team viewer both machines are connecting to a central server ....that can likely see everything you do... and your traffic crosses there.

RDP directly goes from your machine to the other machine but because of NAT it can not get though the router. You must port map to get this to work. You may want to add firewall rules to the router or even the end machine to restrict which ip can connect remotely. This one tends to attract hackers