I heard to help muscle growth one has to sleep a lot after doing a workout. How long is the recommended one? Does this mean the best time to workout is at night so you can go to sleep immediately after?
It is quite well known, that average adult human being needs about 8 hours of sleep a day.
In terms of feeling well rested, It does not matter how long you sleep, rather what quality is the sleep You are getting. The same goes for muscle building. Sleeping 7-8 hours every day would be the optimum. More than that, and you risk oversleeping, which, in my experience, is much worse than sleeping too little. There is a good e-book on this subject: How To Sleep Less and Have More Energy Than You Ever Had.
As to the time question: It is never a good idea to go to bed immediately after a workout. You should plan the workout to end at least 2 hours before You go to sleep, to have the best sleep, and the best rest.
Also, if Your goal is weight loss, then the best time to workout is in the morning. You have just woken up, Your energy levels are quite low, carbohydrates are not available, so the body has to burn fat instead.
@Louis: In answer to Your comment,
Right after the workout, Your energy levels are at their highest. It stands to reason, that even if You were tired and sleepy before, You will most definitely be not after a good workout.
Furthermore, our biological clock is temperature oriented. That means, that when You go to sleep, Your body temperature is lowered. That is a prerequisite for a good nights sleep. That is why we sleep best in a cool room, rather than in a hot room. Right after the workout, Your body temperature is quite high, so there will be no sleep for You. This is from a biological standpoint.
In regards to the 2 hours, that is not a specific time limit. That is just something that was mentioned in the book, and I usually follow it, just as a guideline.