In Death of a Salesman, how is Willy Loman a morally-ambiguous character?
Willy Loman wants to do good and he wants to be good, but he is often weak. Also, his good intentions sometimes lead Willy to make poor decisions for himself and as a parent.
When Biff discovers Willy's infidelity, Biff's view of his father is crushed.
...he discovered Willy in a hotel with another woman and became profoundly disillusioned with both Willy and his own life's possibilities.
Up to that point, Biff had seen Willy as Willy wanted to be seen - as a caring, encouraging, and loving father and husband. Willy's honesty and his fidelity are both brought into question in this episode.
Willy's mantra about being well-liked begins to sound less like the advice of a moral man and more like the hollow intonations of a bad actor. We see here, after all, that Willy is playing a part. He is attempting to be a certain kind of person that matches his view of power and success. In pursuing this role, Willy's integrity is compromised and his ability to be honest with himself and with others is severely damaged.
Cheating on his wife and encouraging his son to steal are just two examples of Willy's moral failings. His willingness to berate Charley while accepting money from him is another.
Willy's tenacious attachment to a particular vision of success is less clear on a moral field. This faith in an illusory vision of achievement does not help Willy come to terms with his own life (it functions in quite the opposite way), but it does lend Willy a certain nobility. This nobility does not save him, but actually leads him to take his own life.
Willy struggles with the image of his ideal self his entire life, until he can no longer deny the fact that he will never become this ideal self and he commits suicide.
The suicide is a result of Willy's despair at not being a big success and it is also his one last effort to achieve that success. The insurance payment he hopes his family will receive is Willy's final attempt to fit himself into the role of the successful, powerful man who can provide for his family.
The morality of this act is, indeed, ambiguous. He wants to deliver his family from what he sees as depressed circumstances. He wants to deliver them from his failure. To do so, he robs them of a father and husband. Yet, through it all, Willy wants to do good and to be good.