Willy's disastrous dinner with his two sons, during which they both run out on him at the restaurant, spins Willy even more deeply into his personal desperation and despair. When he returns home alone that night, Willy goes into the backyard with a hoe, a flashlight, and packets of vegetable seeds. After Biff and Happy come home sometime later, Biff is stunned to find out that is father is outside in the dark trying to plant his garden. Biff's reacts so strongly because he realizes the extent of his father's deteriorating mental condition. His trying to plant a garden in the dark with a flashlight indicates that Willy has lost his grasp on reality even more than Biff had imagined.
Why would Willy choose this time to start a garden? Everything he has valued in his life has slipped away from him, and the dinner with Biff and Happy has forced him now to recognize what failures his sons truly are--and by extension, what a failure he has been as a father. There is nothing he can do to change his intolerable circumstances, but a man has to do something, to take action of some kind, so Willy starts his garden in a place where the sun will never reach it. His action is illogical and doomed to fail. It is a final act of desperation as Willy tries to regain some sense of control in his life. Willy's planting the seeds can be interpreted symbolically, as well. The "seeds" he planted during his lifetime did not grow and thrive either, just as these will not. Symbolically, Willy tries one last time to create something worthwhile, but he has run out of time.
Willy has realized that his sons will not continue on a legacy that he had dreamed of and then comes to the realization that he has no legacy at all, and has been trying to kill himself for months. He plants a garden in the knowledge that they will grow and flower even if he dies, a legacy of sorts to brighten the world before he finally commits suicide.