How can I gain muscle without gaining body fat?

I know it's a little bit hard but, I'm going 5 times a week to the gym and I'm trying to gain muscle but talking about food, what should I do (I know it's the most important part) if I don't want to gain that much fat but still eat to help my muscle gaining goal?

Also, I don't understand a lot about protein powder and pre workout please if you can, advise me. I don't have te money right now to get a personal trainer and nutritionist

Sorry if my grammar it's a little bit off. English isn't my first language.