The restriction to any open subset $M \subset U$ is still a diffeo onto the image $g(M) \subset U$, as you should be able to see from the definition.
More generally, if the subset $M$, when equipped with the topology and differentiable structure induced from $\mathbb{R}$, is a differentiable manifold, then $g: M \to g(M)$ will be a diffeo.
For weirder subsets it may not make sense to talk about diffeos, since these are basically only defined on differential manifolds. For instance, if $g$ is originally a diffeo from $\mathbb{R}^2$ onto itself and you consider the subset $M$ to be two intersecting lines, it makes no sense to talk about diffeos on $M$, because it has no differentiable structure of its own (one can not define a chart around the intersection point).
Of course, in the situation you describe it will always be possible to extend $g\rvert_M$ to a diffeo on a larger space, so the function $g\rvert_M$ will have nice properties, but it may itself not be a diffeo because of technical reasons, as exemplified above.