Developers like developing things. More specifically, they like developing new things. Left to their own devices, developers have a tendency to build many more things than is strictly necessary, in ways that are more complex than needed, in order to handle every conceivable use case and weird edge condition.
YAGNI combats this tendency with a straightforward idea: don't add features, capabilities, or bits of code unless you absolutely need them right now. Instead of planning for every possible future scenario, focus on what's essential at the moment. This approach is a perfect fit with Agile methods, which emphasise delivering small, manageable changes rather than big, speculative ones.
I'm a wholehearted believer in YAGNI. It fits really well with "optimising for speed to market" and the idea that your first (MVP) attempt is going to need rewriting anyway. The less code you've written in the first place, the faster it's going to be to make it work properly the second time round.
YAGNI does, however, require a shift in mindset. Aside from having to watch over development teams like a hawk to make sure they aren't building things that aren't needed, there is inevitably going to be pressure from stakeholders (and therefore the customer and sales teams) pushing for features.
This is tough - and sometimes impossible - to resist. It's always worth asking stakeholders how much they value something (or how quickly they really need it) by getting them to rank any requirements and then asking what would happen if they only got the top two. Chances are they'll still sign up and you'll have saved yourself a whole load of legacy code problems.