Okay, both things matter, but I'd prioritize them differently. Yeah, primer is critical, but paint isn't just different types for no reason either. For a bathroom you really do need moisture-resistant acrylic or latex, but I'd recommend acrylic as the priority - it holds up stronger and handles humidity swings better. Latex is fine too, but acrylic has proven itself reliable in wet rooms for ages now. The can should say something like "for damp rooms" or "enhanced moisture resistance" - that's not marketing, it's actually a different formula.
But prep work - that's the foundation. Before you paint, you've got to prime the walls with a primer for damp rooms (there are special ones for that too). If the walls are uneven or were painted before - spackle, smooth it out, then primer. I've seen people buy expensive paint and then wonder why it peels. Usually it's thin primer or no primer at all that's the culprit, not the paint itself.
And one more thing - ventilation. Even with moisture-resistant paint, if there's no proper air circulation in the bathroom, nothing lasts long. Get an exhaust fan going if you don't have one yet.