Lets' consider the second URL:
http://localhost**/home/user/test/index.php**
If you look in Apache's configuration you will notice that there is a directive called "DocumentRoot". This directive specifies where apache will map the initial "/" in the URL to.
So, let's say that the DocumentRoot is set to /var/www/htdocs. When you request the path /home/user/test/index.php it will actially go looking for .... /var/www/htdocs/home/user/test/index.php, which I'm assuming doesn't exist. See DocumentRoot
Ok, so why does the first one work? Because of Apache's UserDir module. This little module checks the "/~user/test/index.php" part of the link. The tilde (~) is what does it :). It then maps /~user/ to /home/user/, thus Apache will look for the file at /home/user/test/index.php. Voilá.
Hope this helps.