The symptoms that you describe (irritability, pessimism, lack of ability to accomplish tasks) could mean that you could be suffering from depression. This diagnosis would need to be confirmed by a professional. What you are experiencing has nothing to do with being a good person. Whether it be by life events or changes in your chemistry, people can find themselves in the state of mind you describe. It is not a fault or something you are doing wrong. It is challenging enough addressing the symptoms you describe. If you are critical of yourself, you will only be making matters worse.
You have taken an important first step... recognizing that you have a problem. Although it may seem obvious, not all individuals are able to take stock of themselves as you are. The next step is doing something about it. Letting others know that you are in this state of mind and do not like where you are at, could create a good support system in helping you. I would also suggest motivating yourself to do things you used to enjoy doing, but have stopped. Avoiding people, isolating... hopefully, pushing yourself to do things you used to enjoy doing and letting others know that you are in this state of mind will help change or break some patterns that you have established.
Please be aware that this may not be enough. The behaviors you are presenting have been established for awhile. Also, you may be experiencing problems that are beyond the scope of you doing this alone. This may require the help of a therapist and/or psychiatrist. I would suggest not waiting too long to get further assistance.