How do I handle plagiarism professionally and emotionally?
I'm going to suggest that it may not be plagiarism at all, but just parallel work. I don't have evidence one way or the other of course, but please consider the following points.
First, I hope that your advisor is satisfied with your work and that your advancement toward a degree is not at risk here.
Second, a charge of plagiarism is very serious. It is career ending in many cases and can be career ending for an accuser if it is judged to be a false charge.
Third, parallel work is very common - especially in popular research areas. If two researchers start out at the same time they have access to all of the same tools, datasets, publications, etc. In particular, if they are connected to the "grapevine" they have access to the general feeling in the community about what is important and which lines of inquiry are "ripe" for exploration. In fields that have seen a lot of activity over a long time (mathematics, say), this is less likely as the questions get increasingly esoteric and the field becomes a web of narrow concerns. But working in esoteric fields has its own difficulties, of course.
Fourth, your failure to publish could be due to a lot of things. It may just be that the reviewers of the other work had lower standards than those who reviewed yours. You can't control that, of course. But it may be flaws in your paper as, I hope, would be detailed in reviewer reports you received over time. It may just be that the reviewers found the other work more comprehensible. It may even be just timing. The paper landed at a time when some of the reviewers were actually looking for a paper like that.
You may never be able to publish this work as you suggest, but you can move beyond it and publish future work based on it and the knowledge and skill you developed in exploring it.
The only way that I can see it as potential plagiarism is if one of your early reviewers unethically took your idea and specifically set a student to exploit it while rejecting your work. I don't think that is impossible, but shouldn't be a concern with reputable journals. If it is, then the whole structure of review falls apart.
But two people having the same, even detailed, idea at the same time isn't plagiarism. It isn't even uncommon. Similarity of result isn't plagiarism. Ideas are free for everyone. Direction of approach to solving problems is commonly known within a larger research community.
You might be able to salvage some of your work for a new paper, even without extending it. Focus on what is different from and better than the now published paper. You indicate that there is some of that in your work. You can still make important contributions here, though not the ones you originally hoped for.
I suspect that your advisor understands all of this and so is reluctant to make a charge that, if proved wrong, will destroy your career.
For an exploration about how bad it can be see The Double Helix.
Bad things happen to good researchers. Sad. True. You had a bad experience. Don't let it damage your career.
Let me note in closing, that getting beaten to the punch if it is really just that, leaves you emotionally in about the same place. Mad, sad, devastated. All natural.
It is possible that one of your reviewers stole your idea. This happens in academia, and reviewer anonymity can hide the person's tracks. This could even be a reviewer with good intentions but who acted unethically by letting a review paper give them some ideas. If you have good evidence to believe plagiarism, you should contact the editor(s) of the journals or conferences to which you have submitted your paper for review and explain the situation.
If you contact the editors, do not assume plagiarism. Simply explain that although this other work was hopefully and probably done in parallel, you have some evidence that it may not have been and you would like to inform them of the potential issue. Then, it is out of your hands, and you should follow all of Buffy's good advice: assume from that point that the other authors were not your reviewers, and were publishing in good faith.
This leaves the question: how can you prevent this in the future? One way that is effective in some fields (I am not sure whether it is common in your field) is to publish drafts and preprints on your website. This allows you to have documented proof that you had an idea first. If it is only a draft, then maybe they do not have to cite it, and their work still may prevent yours from being published. However, if you have a draft online, then at least everyone will know that you are not guilty of plagiarism.