Suppose you have linear model and a single feature named "color" (for the sake of simplicity). In linear model you look for a coefficient $\theta_1$ which is going to multiply this feature $x$ in your hypothesis function $h\left(x\right) = \theta_1x$ + $\theta_2$. Likewise if you had something like neural network or logistic regression you would look for a coefficient $\theta_1$ which is going to multiply this color featue in the hypothesis function $h\left(x\right) = \mathrm{sigm}(\theta_1x$ + $\theta_2)$.
So if your colors are encoded using numbers $1$ and $2$, then it doesn't make sense if the red color results in $\theta \cdot 1$ and the blue color results in $\theta \cdot 2$ whatever that $\theta$ is.
My question: Is one hot encoding preferable only in such models where you multliply the feature by some coefficient? For example does it matter which encoding to use in random forest? (I'm not sure but as I know when you calculate entropy you don't multiply features by coefficients in the way shown above)