Here's an alternate proof which doesn't use invariance of domain. It also gives a slightly stronger result.
Theorem:
Let $M^n$ be compact without boundary. Then there is no immersion $f:M\rightarrow \mathbb{R}^n$.
Proof: (sketch). Assume for a contradiction there is such an $f$. Since $M$ is compact, $f$ is a closed map, that is, it maps closed sets to closed sets. To see this, let $F\subseteq M$ be closed. Then it's compact because $M$ is, so $f(F)$ is compact, hence closed. (Here, we just use the fact that $f$ is continuous).
Further, $f$ is an open map. That it, it maps open sets to open sets. To see this, note that it is enough to map really small open sets to open sets because $f(\bigcup U_i) = \bigcup f(U_i)$.
It's a fact (a consequence of the implicit function theorem, if I recall) that every immersion locally looks like the natural inclusion $\mathbb{R}^k\rightarrow \mathbb{R}^n$ into the first $k$ coordinates. (This uses the boundarylessness of $M$ - if $p$ is on the boundary, this part doesn't work.)
Said more precisely, given our immersion $f$ and a point $p\in M$, there is a chart around $p$ and around $f(p)$ so that in these chart coordinates, $f$ looks like the inclusion.
Now, in our case $k = n$ and then the natural inclusion is a homeomorphism. This implies open sets in these special charts are mapped to open sets, so $f$ is open.
Putting this together, we've now seen that $f$ is an open and closed mapping. Now, what is $f(M)$? It must be compact because $M$ is, but it must also be both open and closed in $R^n$ because $M$ is open and closed in itself. This implies $f(M) = \mathbb{R}^n$ since that's the only nonempty clopen subset of $\mathbb{R}^n$, but $\mathbb{R}^n$ isn't compact, so we've reached a contradiction.
I believe I've found the answer in this text and more details in Kosinski's differential manifolds, p. 53. In a nutshell: for a neat submanifold $N$ of $M$, one can define the normal bundle abstractly as the quotient $(T_N M)/TN$.
Any choice of Riemannian metric induces an "orthogonal" representation of the normal bundle.
Choosing a vector field $X$ on $\partial M$ in the "inwards" direction such that $X_{\partial N}\subseteq TN$ induces a line bundle $\nu$ over $\partial M$ and a decomposition $T_{\partial M}M=T(\partial M)\oplus \nu$ which induces an isomorphism
$$T_{\partial N}M/T_{\partial N}N\simeq T_{\partial N}\partial M/T(\partial N),$$
so the notion of the normal bundle of $N$ in $M$ and $\partial N$ in $\partial M$ are compatible.
The key idea to get a tubular neighborhood diffeomorphic to the normal bundle is to choose a metric on $\partial M$, extend it to a product metric on a collar neighborhood of $\partial M$ that is induced by the vector field $X$, and then extend it to a smooth metric on whole $M$. Then normal vectors to $N$ on $\partial N$ coincide with normal vectors to $\partial N$ in $\partial M$, geodesics in $\partial M$ stay in $\partial M$, and the "geodesic" construction of tubular neighborhood works up to the boundary. If the normal bundle is trivial, it reduces to the answer to my question.
(Note that in Kosinski, the notation of $N$ and $M$ is reversed.) I hope that it makes sense and I understood the key points of Freeds concise text correctly.
Best Answer
A sufficient condition for $N\subset M$ to be orientable is the following:(Assume $M$ is orientable, $\dim M=m$, $\dim N=n)$:
$N$ is orientable if there are $m-n$ independent vector fields $V_{n+1} \ldots V_{m}$ along $N$ (tangent to $M$ but not tangent to $N$) such that for each $x\in N$, $T_{x} N \oplus \text{span} \{ V_{n+1}(x), \ldots V_{m}(x)\}= T_{x} M$.
The reason: Assume $\Omega$ is a volume form for $M$(orientability is equivalent to existence of volume form). Then $I_{V_{n+1}} \circ I_{V_{n+2}},\circ \ldots \circ I_{V_{m}}(\Omega)$ is a volume form for $N.$
Example:$S^{n} \subset \mathbb{R}^{n+1}$. The vector field $V_{n+1}=\frac{\partial}{\partial r}$ is the radial vector field, orthogonal to the sphere. Then $i_{\frac{\partial}{\partial r}} dx_{1}\wedge dx_{2}\wedge \ldots dx_{n}$ is the natural intrinsic volum form of the sphere.