wangdy, www.domain.com is a subdomain of domain.com, just as home.domain.com is.
You do not have to redirect in order to process the user-agent's request - In almost all cases, a request for www.domain.com and for domain.com will return the same content - unless you have set it up otherwise.
The advantage of doing a redirect is to "concentrate" link popularity and "branding" into one domain or the other - you choose.
For example, if you decide to use "domain.com" as your "official" web address, then you would redirect any requests for www.domain.com to domain.com using a 301 redirect. Anyone who typed in "www.domain.com" would see the URL in his address bar "magically" change from [domain.com...] to [domain.com....] This would help prevent other webmasters from linking to your "unofficial" address, and would help to fix "domain.com" in the minds of your visitors for branding purposes.
Advanced robots like Googlebot can figure out when www.domain.com is the same site as domain.com, but there may be others that can't - and so you might end up with two listings on page 3 of the search results instead of one listing on page one.
Hope that clarifies things a little.
Jim
<edit>typos</edit>