I always feel pessimistic and expect the worst. What is the ruling on this pessimism and how can I get rid of it?
All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
Expecting the worst continually for no specific reason is considered the prohibited type of pessimism because it is mistrusting Allah, The Almighty, and an expecting evil. It was narrated on the authority of Abu Hurayrah that the Prophet used to like optimism and detest pessimism. [Ibn Maajah]
Therefore, in principle, a Muslim should be optimistic and hope for good from Allah, The Almighty, even if the reasons for such hope are weak, because if a Muslim despairs of the Mercy of Allah, The Almighty, then evil will afflict him.
The Prophet paid a visit to a sick Bedouin and supplicated for him saying: "No harm will befall you. May Allah cure you." The Bedouin countered this, saying that it was a very strong fever that would cause his death. The Prophet said: "Yes, then may it be as you say." (i.e. as long as you reject safety and think ill of Allah, The Almighty, then may it be as you say). It was narrated that this Bedouin died the next morning.
We advise you to sincerely put your complete trust in Allah, The Almighty, and have complete faith in Him, and this will be your remedy, since the Prophet mentioned that believing in evil omens is Shirk (polytheism), and everyone is subject to it to a certain extent. However, it can be eliminated by putting complete trust in Allah, The Exalted. [Ibn Maajah and others]
Therefore, pessimism and believing in evil omens occur with everyone, but they are defeated by putting complete trust and confidence in Allah, The Almighty. Thus, there is no sin from any pessimistic idea if it is followed by repentance to Allah, The Almighty. However, the danger lies in letting this idea get stronger and firmer.
Allah Knows best.
You can search for fatwa through many choices