This question comes up *a lot*. If you're a project manager reading this and worrying about your job, first of all, try to relax, all is not lost.
It's true to say that in agile as a broader mindset, and in the specific frameworks you can use to take an agile approach, there is very little mention of project managers. In fact one of the only agile frameworks to mention them specifically is DSDM.
On top of this, you sometimes get agile consultants and coaches that are quite passionate about sticking to the way things are prescribed, so sometimes they go around telling people that all of the project managers must be removed, with little care for what happens to them afterwards. Whilst it may be technically correct, it doesn't seem like a helpful approach.
The fact that it exists as an approach in many ways reflects the tension between traditional and agile approaches to delivery. In many situations, project managers are seen as holding views that make agile more difficult, if not sometimes impossible. Traditional project managers often want to write the delivery plan and assign tasks to people, when agile teams want to write their own plans and decide amongst themselves who does what. Project managers often like to try to get people to stick to timescales, costs and scope requirements that have been decided up front, when agile teams know that things often end up better if they are allowed to change as they go along. It's undeniable that a tension often exists between the two, so this does need to be faced into and resolved. Thankfully, there are a number of different ways of doing this.
The first and perhaps most obvious way to fix things is to see if you can retrain project managers to take new roles within your agile framework of choice. After all, these people often have tons of skills, contacts, experience and organisational knowledge that it would be foolish to throw away.
If you're the sort of project manager that likes supporting teams, getting problems dealt with, coaching people and generally doing what's needed to help the team be the best that it can be, then you might want to take a look at the Scrum Master role in Scrum, and see if it sounds like it might be interesting. You'd have to let go of your desire to tell people how to work and what to do, as that's largely up to the teams themselves to figure out now, but there's still lots of great work to do in serving and supporting the team.
Alternatively, if you've always been into the details of what is getting created, managing stakeholders and taking their views on board, looking after the financials of how much is getting spent against how much profit is likely to be generated, keeping people up to date on how the delivery is going, then you might want to look at whether the product owner role might be a good one for you to move into.
There are lots of roles within various different agile frameworks, and as long as you're prepared to make the mindset shift from commanding, managing, directing and controlling, to supporting, helping, coaching and facilitating, then you might well find an agile way of working is less stressful and ultimately more enjoyable.
Another technique that has been tried out and worked well at some larger organisations has been to retain the project managers, and let them do all of the work that the organisation still needs to have done, but that distracts the team from delivery. Whilst in an ideal world an organisation moving to agile would look to cut out as much waste from its ways of working as possible, sometimes this takes time to achieve, or is made more difficult by the requirements of an external regulatory environment.
In situations like this, the project managers can be used as a buffer to keep the organisational waste, bureaucracy and noise away from the teams doing the work and working in an agile way. You have to be careful here that the project managers do in reality act as a buffer, and don't start coming to the teams enforcing the consequences of the organisational noise on to them (such as insisting on fixed timescales with fixed scope). However, as long as they do, then this setup can run quite well.
In short, there are practices and behaviours that some project managers display that are not helpful, and can even be actively harmful, to people and teams wanting to take an agile approach. These have to stop. However, try to separate the practices and behaviours from the people themselves. The people often have years of valuable skills and experience that it would be foolish to throw away. Far better to find them a new role, one that helps the agile adoption grow even stronger.