\textrm (and the corresponding switch
\rmfamily) changes an aspect of the font – in this case the family. If possible other aspects – like the series (bold or not) or the shape (italic) – are preserved.
\text...-commands can be nested and their "aspect changes" are combined:
\mathrm and the other math alphabets don't change only an aspect of a font. They switch to specific fonts. They make it possible to print symbols in special fonts. It is quite possible to setup things so that e.g.
\mathrm use times,
\mathbf is a bold palatino,
\mathit a slanted Arial etc. You can also confuse everyone by defining
\mathbf to be light itshape palatino and
\mathit a bold Arial. You can define your own special math fonts e.g.
\mathfancy. As all these commands switch to dedicated font they can't be nested. The last command (the inner one) always wins: