The existence of such a biholomorphism is rather rare. For example, as a simple exercise you can check that already for a conic in $\mathbb CP^2$ such a biholomorphism does not exist. At the same time, in the case $M$ is "exceptional" in $X$, for example, $X$ is obtained by a blow up from $X'$ at a point $x'\in X'$ and $M$ is the exceptional divisor, the situation is the often the one you want (I don't specify purposefully here what "exceptional" means). *Solution to the exercise.* Everything follows from the fact that each holomorphic map from $\mathbb CP^1$ to itself has at least one fixed point. Indeed if a neighbourhood of a conic in $\mathbb CP^2$ were biholomorphic to a neighbourhood of $O(4)$ bundle over $\mathbb CP^1$ then there would be a holomorphic family of lines in $\mathbb CP^2$ parametrised by the points of the conic passing through the corresponding point of the conic and transversal to it. Such a family of lines would induce a holomorphic self-map of the conic without fixed point (take the second intersection of each line with the conic). Contradiction. **PS.** I remember a theorem that states that the only smooth hypersurface in $\mathbb CP^n$ that has a neighbourhood isomorphic to a neighbourhood of a zero section in a line bundle is a linear $\mathbb CP^{n-1}$ (but I forgot the reference).