Eating healthy food makes me feel worse with bloating and constipation, but when I dont eat as healthy it makes me feel better. Why?

Depends. This all depends on what you consider healthy and not. I suggest you evaluate your diet for foods high in FODMAPs (fermentable sugars) and avoid these. Consider starting with removing all dairy products that contain lactose such as milk, cream, ice cream, cheese.