My site is hosted with HostGator and I want to create a subdomain for a different section of the site. When I create the subdomain, the document root is public_html/subdomain. If my subdomain is sub.domain.com then all the content in that document root is visible on sub.domain.com. I am just worrying whether Google will index this subdomain without harming the ranking of it or without harming domain.com.
Yes I know that but I'm not sure whether it will though because it goes into my public_html document root where my main site's files are.
Where the files are stored on your server does not matter. If you are using URL rewrites then the search engines do not see your file structure on your server, they just see your URL or subdomain URL structure.
Have the same problem as AllWhatsRock. So does that mean that when doing SEO, all my backlinks should point at the subdomain URL?
Hostgator has nothing to do with a subdomain, its the sub domain in general that is the problem. Google treats all sub domains as separate sites.