To make a change in anything in life, it's worth the time to practice, or at least acknowledge being kind to yourself along the way. The words that you chose here to describe yourself, are harsh. Clearly, you are hard on yourself. Clearly, you have internalized these narratives. I can assume from you saying you make "bad" thoughts and "don't have the strength" that when you "fail" at anything (a perception of events and often not the reality), you come down hard on yourself. We have to start there when we think about changing.
Now, the perspective of things is often the start of problem behaviors. Your perspective on your life, on your situation, you admit is a pessimistic one. So then, why do you believe it? If you know it is negative and harmful, why let it consume you? It's like acknowledging a sandwich tastes bad, but then you continue to eat it. You notice how your thoughts, they go a certain way, yet, you let them. Your preconceived, habitual judgment of them takes you there. Notice how when things happen in life, your immediate response may be to beat yourself up first. Notice your thoughts, not after the fact, when we summarize them, judge them, or wish them away, but notice that you have thoughts and that these thoughts occur as a response to something in life.
You do have one thing correct here. Not that you have bad thoughts, but because you have thoughts, you judge them as bad or not. You acknowledge that life isn't about the outside world (outside of our head) but our perception of these events. Yes, since you notice that, you know the work to be done to change is all within our perspective of things, and how we choose to think about them. What I mean about choice is when the thoughts come up, even those that demand our attention, we can choose to indulge them or not. We still have the power to decide if this thought is helpful, or counterproductive. You need to be more engaged when you want to be less pessimistic. If your thoughts naturally go to the negative, then you need to start seeing the bright side, and there is always a bright side.
Lastly, I am going to address your perspective on "bad" thoughts, and what it means to fail in life. These judgments are also about failure, and actually, people fail very little in life. People quit or avoid due to fear, but they rarely fail. I want to see you fail, actually fail, at trying to improve your life through recognition and separation of your thoughts. Though you might have a hard time doing it, this will be ongoing for the rest of your life, and therefore any, "failure" isn't absolute, but a bump in the road on the way to something greater. Take a step back from the situation and realize that this one moment cannot define you. One-time indulging thoughts aren't on the road you want to go, but it's not absolute to relapse into old ways of thinking either. If you think your thoughts are, "bad," then notice that they come up, realize that you notice them and that you do not have to indulge, remedy, or avoid them. You can allow thoughts to exist, even unpleasant ones, without you doing anything with them. This includes not living with the belief that life will only be better when you get rid of these thoughts. Do not fall into that trap. The more you wish these thoughts away, the louder they speak. So, acknowledge they exist, choose to separate from them, and see the benefits of any situation, i.e., a learning experience, a wisdom opportunity, an opportunity to learn about yourself. You will be better for acknowledging the thoughts than wishing them away.