Generosity in Buddhism - When does giving become unwholesome? Buddha said that generosity is essential for enlightenment.


  O monks, if people knew, as I know, the results of giving and sharing, they would not eat without having given, nor would they allow the stain of stinginess to obsess them and take root in their minds. Even if it were their last morsel, their last mouthful, they would not eat without having shared it, if there were someone to share it with. But, monks, as people do not know, as I know, the result of giving and sharing, they eat without having given, and the stain of stinginess obsesses them and takes root in their minds.”
  – Itivuttaka 26: 18-19 (tr. Ven. Bodhi)


Lets take an example . If there is a material object that I want to donate , and it will be used for a very good cause. However , I really like this material object and I feel I might want it ( definitely don't need it for my survival or anything like that) . The thought of giving this object does not make me happy. If I force myself and give up this object , will my giving (generosity) be unwholesome?
Unwholesome actions are those which are based on the three poisons: greed, anger and delusion. When giving is wholesome it is an act of renunciation and it reduces the three poisons.

Giving becomes unwholesome if it is based on the three poisons. Perhaps you want to be famous for giving money so you are willing to give all your cash to charity; in this case you would effectively be buying fame and it is fueled by greed. This kind of giving is like a trade, you still want money but you've decided that fame is worth more; this type of giving is not renunciation.

You can come up with similar examples where the act of giving increases anger or the delusion of self-view, they would all be unwholesome giving.