In the last part of Arthur Miller's play Death of a Salesman, aptly titled "Requiem", we see the Loman family coming to a series of realizations that they were perhaps too scared to make while Willy was alive.
The first realization is that nobody goes to Willy's funeral with the exception of Charley, as expected. This is a shock to the family considering the grandiose persona that Willy projected to the world as a well-liked and popular salesman.
The second realization is that Willy dies out of desperation. He wants to leave his children some form of legacy. Deprived of any other resource, Willy kills himself to leave his sons his life insurance so that they can pursue their dreams. This is clearly a symbol for the sacrifices that has to be made at times to achieve our own idea of the American Dream.
Finally, it is Willy's American Dream what hits Biff the most. This is why he says "he had the wrong dream all along".
This is huge coming from Biff who has been nothing but a breathing nobody during his adulthood; a man who is completely dependent on the opinion of his now defunct father. However, the fact that Biff actually says such a thing is indicative that he has finally unveiled the true reality of his father: Willy never succeeds because Willy never goes for what his heart and mind have in store for him. Instead, Willy sees how Dave Singleman is successful and well-liked and decides to live another man's dream.
Had Willy bothered, in his past, to listen to his life and what it could have offered him, he would not be dead at the time of this scene. Biff knows this and that is why, instead of perpetuating the ridiculous idea of becoming a famous salesman, he chooses to change paths altogether. He knows that if he stays and follows his father's steps he too would be living up to the wrong dream. Although Happy does the opposite and talks about entering the world of business for the sake of his father's legacy, Biff knows better. He has learned from his father's huge mistake, and he leaves. Perhaps it is Willy's mistake in choosing his dream what really becomes Biff's ultimate salvation, and Willy's best legacy for him.