I skimmed the PHB but I wasn't able to find any information on "retraining" or any ways to "undo" character advancement. Is retraining (especially of classes and class features) available in any of the core books? How does it work?
There are no options in any of the core D&D 5e books which allow "retraining" a class using any definition of "retraining" that I can think of.
The only options for training of any sort I see at all are:
The PHB offers rules for multiclassing (p163) but this isn't so much "retraining" as it is training in a different field entirely.
The PHB (p187) presents training in a tool or language as a possible downtime activity. It says, "Your DM might allow additional training options." It takes about as long as a public school year in the US to complete one training option.
The DMG (p131) presents optional rules for training to gain levels. That is to say, with these optional rules you must spend gold when you reach the required XP value to gain a level. This training lasts about 2 days per level.
The DMG (p231) also presents rules for granting training as an "alternative reward." That means this option is presented as an alternative to magic items, so you're not going to be able to just go out and do it. You can spend the same amount of downtime that the PHB requires for training to learn a new skill, gain a feat, or gain inspiration daily for about a week. You'd have to ask someone else how 7-10 days of inspiration compares to a permanent skill or feat, let alone would be worth the 9 months of investment to get it.
However, keep in mind this is 5e, not 3e, and the game takes great pains to remind readers that the DM can use whatever options he wants in his game, including those he makes up himself or adopts from other games.
This depends a lot on the context. There's two I can think of off the top of my head.
In the core rules and SRD, no, there's no way to undo training, so choose carefully. Once you've made a class selection, you're keeping it unless there's some serious voodoo involved (or you're a druid/cleric/paladin and lose your powers by offending your god/philosophy).
In D&D Adventurer's League, you're permitted to rebuild your character up to the end of Level 4 (Player's Guide, page 4, "Character Rebuilding"), though your name must stay the same and any faction renown is lost if you change factions.