How to be happy and stop thinking about bad things or how to stop negative thinking?

I've struggled with. This issue myself for the longest time. You can't help it, most of the time. I think growing older has helped me realize there's not much in life other than counting your blessings and being more of a "glass half full" than the other way around. It's hard, bit a heck of a lot happier and positive now than I use to be. I enjoy the now and forget the second before and not worry about tomorrow...
Avoid negativity. Surround yourself with positive people, ones who make you laugh & enjoy life. Involve yourself in activities that bring joy to your life. Adopt a kitten or puppy or other pet. Mentor children/people who can benefit from your knowledge/experience. Raise a flower garden (size isn't important) of bright, cheerful flowers. Volunteer to help others. Engagement with others takes your mind off negative.
No simple answer. A therapist or counselor can help you figure out why you are stuck where you are.Sometimes we obsess over negative things because it may give us an excuse to not change or try something new. There will always be dark and light in our lives; happiness is finding the right balance.