Donald Farfrae is, in many respects, the complete opposite of Michael Henchard. He's forgiving where Henchard is resentful. He is practical where Henchard is superstitious. He is light-hearted and cheerful where Henchard tends to be gloomy and depressed. They're even physically opposite: Farfrae is "fair and ruddy, bright-eyed, and slight in build" (6.2), while Henchard is tall, strong, and with dark eyes and complexion.
Their fates are opposite, too, although they start out similarly: they both arrive in Casterbridge as strangers and begin their lives there working for other people. Both of them rise to power and wealth and eventually become mayor. But while Henchard's flaws and misfortunes cause him to lose his position, Farfrae's more positive outlook on life helps him maintain and even improve his position. They're in love with the same woman, Lucetta, but she ends up marrying Farfrae. Essentially, Farfrae's fate is a kind of positive mirror of Henchard's: his is the life that Henchard could have had if it weren't for his own unchangeable bad temper.
But Farfrae's character is too complicated to dismiss as a simple narrative device, even if he does serve as a foil for Michael Henchard. What else is there to say about Farfrae? What, exactly, is it about this guy that makes everyone like him so much?
Let's look at the first evening Farfrae arrives in Casterbridge. He sits in the main room of the King of Prussia Inn, and at the request of the other townspeople hanging out there, he sings songs from Scotland, where he's from. He pours all his homesickness and nostalgia into the songs, and everyone is touched by his performance. They are all impressed both by his deep feelings and his loyalty to his home country. Elizabeth-Jane, in particular, is impressed by the "serious light in which he looked at serious things" (8.33). She notices that Farfrae can be cheerful, but is too moral to joke about things like theft or dishonesty. Farfrae is able to make friends quickly because he's social and cheerful, and he's able to keep friends because people respect his loyalty and his serious, moral streak.