Analysis
When tex4ht.sty is loaded, that is, during processing with htlatex, the character _ doesn't have category code 8 as usual in TeX, but category code 12 and it becomes “math active”, so that, when it is scanned in math mode, TeX considers it as if it were an active character, with the definition
_=macro:
->\ifmmode \expandafter \pr:sb \else \expandafter \sys:sb \fi .
So now \pr:sb remains, because we are in math mode (reserved macros of tex4ht.sty have colons in their names). Here's the definition:
\pr:sb ->\ifx \EndPicture \:UnDef \expandafter \Protect \expandafter \S:b \else
\expandafter \s:b \fi
In your case, \EndPicture (of which I ignore the function) is not defined, so what's substituted is \Protect\S:b and it's here where the problem begins. The macro \Protect is irrelevant in this case (it's similar to the usual \protect), and \S:b is
\S:b #1->\def \SuB: {#1}\futurelet \:temp \sub:sup
OK, #1 is \mathit, so we have
\def\SuB:{\mathit}\futurelet\:temp\sub:sup
I won't follow the processing any more: the idea is that what's stored in \SuB is what is to be subscripted, so you get the equivalent of
x_{\mathit}
which is definitely wrong.
If \EndPicture is defined, \s:b would be used, which produces a normal _8` character and the compilation would proceed without errors; however, the output wouldn't be correct: “in” appears in smaller type, but not as a subscript.
Conclusion
Always use $x_{\mathit{in}}$. As explained in my answer to Why does `x_\text y` work?, the fact that $x_\mathit{in}$ works relies on the assumption that _ is the usual subscript character.
\mathitwithtex4ht. While$x_\mathit{in}$works in LaTeX, it's better to use$x_{\mathit{in}}$anyway. – egreg May 13 '14 at 23:17_\mathit{}form only works because of the rather weird parsing of the tex primitive, if you had a macro (or active character) that took an argument#1then you wouldn't be able to go \mathit{}as#1would just be\mathittex4ht probably makes` active so it can write the specials it needs in the conversion, so that makes it have the standard argument behaviour. – David Carlisle May 14 '14 at 00:21