Scott thought it was a quote by Spinoza, but it seems almost universally to be attributed to Madame de Stael. Wikipedia says:
Anne Louise Germaine de Staël-Holstein, commonly known as Madame de Staël, was a French-speaking Swiss author living in Paris and abroad. She influenced literary tastes in Europe at the turn of the 19th century.
In the original French the saying is “Tout comprendre c’est tout pardonner.”
The quote only ever seems to be “attributed” to her, though, and it’s also often described as a “proverb,” which makes it unattributable. There’s no hard evidence that Mme. de Staël actually said this. However, in a 19th century book, The Cyclopedia of Practical Quotations, a similar quote is given with a reference to one of her books:
The more we know, the better we forgive ; Whoe’er feels deeply, feels for all who live. s. Madame de Stael — Corinne. Bk. XVIII. Ch. V
And in fact that quote is in Corinne, but only in an English translation (by Isabel Hill and L. E. Landon). In the original French we find something rather different:
“Car tout comprendre rend très indulgent, et sentir profondément inspire une grande bontée.”
(“To understand everything makes one tolerant, and to feel deeply inspires great kindness.”)
The Buddha doesn’t seem to have talked much about “forgiveness.” He talked much more about letting go of anger, as in these verses from the Dhammapada:
3. “He abused me, he struck me, he overpowered me, he robbed me.” Those who harbor such thoughts do not still their hatred.
4. “He abused me, he struck me, he overpowered me, he robbed me.” Those who do not harbor such thoughts still their hatred.
223. Overcome the angry by non-anger; overcome the wicked by goodness; overcome the miser by generosity; overcome the liar by truth.
Clearly resentment is something to be let go of, even if the word forgiveness isn’t mentioned.
Forgiveness is more explicitly mentioned elsewhere, for example in this sutta:
“Monks, these two are fools. Which two? The one who doesn’t see his transgression as a transgression, and the one who doesn’t rightfully pardon another who has confessed his transgression. These two are fools.
“These two are wise people. Which two? The one who sees his transgression as a transgression, and the one who rightfully pardons another who has confessed his transgression. These two are wise people.”
The reason for forgiveness in Buddhism seems to be mostly connected with the destructive effect that anger has, and the bad effect it has on us. The famous Buddhist scholar Buddhaghosa pointed out very eloquently how our anger often hurts us more than the person we’re angry with. They may not even be aware of our anger!