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 $C$ in $\mathbb CP^2$ were biholomorphic to a neighbourhood of $O(4)$ bundle over $\mathbb CP^1$ then the restriction of $T \mathbb CP^2$ to $C$ would holomorphically decompose as a sum $N_C\oplus TC$ where $N_C$ is a line subbundle of the restriction. Now consider a line $L_x$ through each point $x$ of $C$ tangent to the direction $N_C(x)$. Finally consider $y(x)=L_x\cap C$ the second point of the intersection of $L(x)$ with $C$. We got the map $C\to C$ without fixed points, this is a contractioction. **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}$. Thanks to jvp for the link below!