Let us discuss first the differntial geometry case. Here, you can use the tubular neighbourhood theorem to extend the vector bundle. Explicitly, you have a neighbourhood $U$ of $Y$ in $X$ which is isomorphic to a neighbourhood of the zero section of the normal bundle. So you have a projection
$$
\pi\colon U \to Y
$$
and use it to pull-back $TY$ to $U$.
In complex geometry, the tubular neighbourhood theorem holds just locally, because you do not have partition of unity. However, under some apporpiate condition, this theorem holds, so you can perform the same construction. This is a classical result of Grauert. See for instance the survey
http://w3.impa.br/~hossein/myarticles/imca03.pdf
and references therein.