When the new person you’re training is going to be in a position above you or your supervisor.
Why wasn’t the position offered to you instead? Why were you not considered?
If you’re obviously capable of training your soon-to-be boss, then you obviously know what the role details, or enough of it to perform in the role.
This just shows how little you are valued at your current job.
That your skillset and qualification are overlooked or not being harnessed.
And if this person is outside of the company, your bags should be packed.