Trub (rhymes roughly with "tube") is the sediment layer that settles at the bottom of a kettle or fermenter — a mix of spent hop material, hot- and cold-break protein, and, once fermentation is underway, dead and settled yeast. It's not one single substance so much as a catch-all term for "everything solid that isn't clear liquid" at a given stage.
Kettle trub and fermenter trub aren't quite the same thing
Kettle trub (hop matter plus hot and cold break, before fermentation) and fermenter trub (settled yeast plus whatever kettle trub made it through the transfer) get called by the same name but serve different roles in troubleshooting — kettle trub left behind through careful racking improves finished-beer clarity and can reduce certain off-flavor risks, while fermenter trub left behind at racking to secondary (or at bottling) is mainly about avoiding excess yeast character and autolysis risk in a long-conditioned beer.
Losing some beer to trub is normal, not a mistake
Any transfer that leaves trub behind also leaves a small amount of beer trapped in and around it — a real, unavoidable yield loss every recipe calculation should account for rather than being surprised by a lower-than-expected final packaged volume after racking cleanly off a substantial trub layer.