I'm interested in both version of the question in the title, i.e. in the topological category and in the smooth category. By a topological immersion I mean a local embedding. I was asking in relation to this question:

https://math.stackexchange.com/questions/1801318/dimensions-of-immersions-vs-embeddings

In the very nice answer given in that thread, they work out almost all of the low-dimensional cases for smooth, compact manifolds and smooth immersions/embeddings. The only 'smooth, compact' case not covered by their answer is the one in the title of this question, so it would be interesting to know if there is a *compact* example, separately.

To be honest I'm more curious about the topological case, though. To what extent is there a topological version of the Cohen Immersion Theorem? Also, can someone clarify their answer wrt the constant in the Cohen theorem? They say it's $2n - a(n) -1$; is that an improvement for the compact case? If so then any smooth, compact manifold immerses in $\mathbb{R}^6$ so the Massey example suffices. But still curious about the non-compact case.

EDIT: A nice answer below completes the compact smooth case. For general $4$-manifolds the case of immersion in $\mathbb{R}^5$ is what remains:

Is every compact $4$-manifold which immerses in $\mathbb{R}^5$ smoothable?

Is there a $4$-manifold that immerses in $\mathbb{R}^5$ but doesn't embed in $\mathbb{R}^6$ (resp. $\mathbb{R}^7$)?

By results of Quinn, every open $4$-manifold is smoothable so it's sufficient to prove the smooth case for non-compact manifolds.