To supplement Igor's answer regarding the situation in dimensions $\ne 4$:
In general, if $X$ is a compact contractible $n$-dimensional manifold, then the boundary $\partial X$ of $X$ is an (integer) homology sphere, meaning that $H_*(\partial X)\cong H_*(S^{n-1})$. (This is an application of the Poincare duality and the long exact sequence of the pair $(X, \partial X)$.) From this, it follows that if $n\le 3$, then the boundary is homeomorphic (hence, diffeomorphic) to $S^{n-1}$, since a homology sphere of dimension $\le 2$ is homeomorphic/diffeomorphic to the ordinary sphere. On the other hand, for every $k\ge 3$ there are many smooth closed $k$-dimensional manifolds which are homology spheres but are not even homotopy-equivalent to spheres since they are not simply-connected (see for instance Theorem in in Kervaire's paper below). The first such example was discovered by Poincare (for $k=3$) and is called the Poincare homology sphere.
Hence, it is reasonable to ask for the converse: "Does every $k$-dimensional homology sphere $M$ bound a compact contractible manifold?" (I am intentionally sloppy about the category in which one is working: smooth or topological manifolds.)
It turns out that if $k\ge 4$ then the answer to this question is positive in the following sense:
Every smooth $k$-dimensional homology sphere is homeomorphic to the boundary of a smooth compact contractible $k+1$-dimensional manifold.
This result is mostly due to Michael Kervaire, Theorem 3 in:
Kervaire, Michel A., Smooth homology spheres and their fundamental groups, Trans. Am. Math. Soc. 144, 67-72 (1969). ZBL0187.20401.
(See also the Wikipedia article linked by Igor.)
For $k=3$ the situation is much more subtle and I will not discuss it (see Igor's answer).
Now, how is it related to your question? Suppose that $X$ is a smooth compact contractible $n$-dimensional manifold, $n\ne 4$. Then double $X$ across its boundary, by gluing another copy of $X$. After "smoothing the corners" the double $DX$ is a smooth manifold containing a diffeomorphic copy of $X$. It is easy to see that $X$ is simply-connected (Seifert-van Kampen's theorem) and is an $n$-dimensional homology sphere (Mayer-Vietoris theorem), and, after some fiddling, can be shown to be diffeomorphic to the standard sphere $S^n$ (this is an application of the h-cobordism theorem if $n\ge 6$ and some work of Milnor if $n=5$). By applying this diffeomorphism $f: DX\to S^n$, we, thus, obtain a smooth embedding
$$
\partial X\to X \to DX \stackrel{f}{\to} S^n
$$
of our homology sphere $\partial X$ to $S^n$ so that the image bounds the contractible domain $f(X)$.
So, when all this is said and done, we conclude that for each $n\ge 5$, there exist smooth submanifolds $M\subset S^n$ which bound contractible domains in $S^n$, but $M$ is not even homotopy-equivalent to $S^{n-1}$. For $n=4$, the conclusion is the same but the proof is a bit more ad hoc (this is where Mazur manifolds show up).