The question of why people have irrational or "mal-adaptive" behaviors is a problem of evoutionary psychology.
I once wrote a paper about this question for a graduate school course in cognitive science; I addressed the slightly more general but closely related question, "why do people do things that are bad for themselves and other people?" This may seem like a stupid question to many people, because we all know that people can be psychologically weak, and are generally subject to the influences of addiction, poor programming by parents, peers, educators, and advertisers, and of course, ignorance. However, even given these factors, these questions remain problematic--because of the nature of evolution.
For those of us who believe in evolution, animal behaviors must be understood or "accounted for" in terms of adaptation; that is to say that although the processes going into evoltuion are technically undirected, the whole process is, in-effect, "teleological," or goal-oriented because, over geological time-spans, species change, through mutation, selection, and inheritance, only in ways which are adaptive, relative to the survival and reproduction of their genes. (This is a gross oversimplification, ignoring indirect processes such as "exaption" and "Baldwinisation"; the interested reader is recommended to the works of Richard Dawkins and Stephen Jay Gould).
In any case, evolution means that if we observe a species, such as humanity, to display consistently self-destructive, maladaptive, behavior, such as you allude to in your question, something has gone terribly wrong! Why would we evolve the capacities for addiction, obsession, or psychosis? Why will human beings pursue things, that they cannot have, or should not want, even to the point of irreparably harming themselves, their families, and their communities?
There are at least two answers to this question, one simple, and one more subtle. The simple answer is that we did not evolve these potentials, but rather failed to evolve mechanisms for preventing or neutralizing them, because the dangers did not exist until very recently (the last few thousand years). Our pre-historic ancestors did not have the opportunity to pursue much of anything to self-destructive excess, so evolution never eliminated that potential from our natures. This is the most popular scientific answer to your question. But the second answer, which I have not seen in print, is more interesting and probably more helpful to you.
The second answer is that humans pursue things at their own expense, because the part of human beings in charge of the pursuit, the "ego"--by which I mean the part of our minds that sees itsef as the center and controller of our conscious actions and experiences--has its own needs for survival and reproduction, which are often different than, and detrimental to, the needs of the physical organism. In other words, the human ego has not evolutionarily adapted to the mental environment in which we live. The ego is a psychic structure whose primary function and need is to identify itself with you, the whole person, and to control your actions; that's what it's for.
Unfortunately, the ego does many less functional things in order to strengthen its existence; perhaps its most common vice is to identify with things which are not really part of you, in order to amplify itself. Think about the way you identify with your favorite sports teams, or the way people get carried away with their "image"; these are some examples of how egos, which are always potentially insecure, strengthen themselves. And this is probably the number one cause of people desiring things that they don't need; subconsciously you feel that if you could get this thing you want, you, or rather your "ego," would be secure.
I am not telling you that egos are evil; our egos serve perfectly valid functions in our lives; but they only developed during the past 5-30,000 years as a result of the surprsing and relatively sudden development of self-consciousness and language in our species, and because they are so recent, their misfunctions have hardly begun to be weeded out by natural selection. So we are stuck with often feeling driven to irrational or self-destructive desires and behaviors. Therefore, if you are looking for a cure for this problem, look to your ego; become aware of how your irrational desires serve your ego-needs, and then you may be able to defuse the urgency of those desires. If you can become aware of why you have these desires, you may be able to replace them with something else that is actually attainable and good for you. If you can't do that, then do what people have always done with painful desires; write poetry!