Protein powder itself does not automatically cause fat gain.
Total calorie intake matters.
A protein shake can be useful when it helps you reach your protein needs.
But adding a shake on top of an already sufficient diet also adds calories.
Use protein powder as a convenient food supplement, not as a magic muscle-building product.