In the places I've worked where management was just jumping on the buzzword bingo bandwagon, what was being done wasn't really "agile". It was more like "Let's adopt all the overhead of agile but not actually empower the developers or stop micromanaging them." So you end up with the same work load plus the overhead of a daily standup for a team that is way too big for actual agility (30 people, 26 are doing things that don't directly affect you,) and an iteration planning that is generally ignored because the team is always in firefighter mode anyway. You never see time allocated to write unit tests or refactor the code that keeps the team in firefighter mode constantly. So yeah, if you do it wrong, agile will fail.
I've been watching the idea since the early 00's. I've been on teams that have adapted the processes to work for the team and have been very successful doing so. I've seen a team get a cadence going and become extremely accurate at estimating new work for a product the same 5 people worked on for 5 years. During that time they also dramatically improved the quality of the code, reducing crashes that required weekend coverage to almost 0. Every once in a while they'd adjust their processes if things weren't working smoothly. Teams can work very effectively in an agile environment, if they're actually allowed to.
If you follow the evolution of agile, you see a lot of key concepts that get repeated over and over. The guys who wrote it understood that code is never perfect and never really correct the first time you write it. It pushes unit testing as a core component of the process. As with other things, making mistakes and correct them teaches you something about the problem, and so the whole process is designed around uncovering those mistakes quickly, throwing code away and rewriting it and constantly improving quality. The philosophy of most companies is that the developers should just crap something out that kind of works and then move on.
What it basically comes down to is just because your team is agile doesn't mean you can hire chimpanzees to write your code. Or manage the team. If you're looking for a silver bullet that will fix what's wrong with your company, agile isn't it. It enforces much more discipline than whatever crappy process you were using before that, but you really have to understand what it's about, and most people don't.