It depends on if this “thing of wanting” is physical, or abstract.
Wanting something you can’t have can be good for motivation. Or it can shape your character, by uprooting some selfishness. But the good and bad of anything unobtainable really depends on how the individual responds to it.
The category of “owning something you don’t want” is trickier. An unwanted physical object can be easily sold on eBay. End of story. But unwanted feelings and hurt are quite another matter. These truly internal wounds are never wanted, but happen and sometimes last an eternity.