It is a standard fact that the inclusion of a sub-CW-complex into a CW-complex is a cofibration, it follows from the fact that the inclusions $S^k\to D^{k+1}$ are, and that they are preserved by pushouts.
My question is about a general closed embedding of a CW-complex into another one, say $f:Y\to X$; but it's not necessarily cellular, and even if it were, it doesn't necessarily witness $Y$ as a sub-CW-complex of $X$.
Is it still necessarily a cofibration ?
If it helps/changes the answer, we may assume that $Y$ or both $X,Y$ are finite dimensional, or even finite (though if the answer is "yes" for one of these cases with more hypotheses and "no" with fewer hypothese, I would still be interested in counterexamples for fewer hypotheses)
This is only a partial answer:
If $X$ is a locally finite CW-complex and $A \subset X$ is a closed subspace which is also a CW-complex (but not necessarily a subcomplex), then $i : A \hookrightarrow X$ is a cofibration.
This is based on three well-known facts.
(1) Locally finite CW-complexes are metrizable.
See e.g. Proposition 1.5.17 of [1].
(2) Metrizable CW-complexes are ANRs.
This is due to the fact that CW-complexes are absolute neighborhood extensors for metrizable spaces.
(3) If $X$ is an ANR and $A$ a closed subset of $X$, then the following are equivalent:
a) the inclusion $i : A \to X$ a cofibration.
b) $A$ is an ANR.
See for example Proposition A.6.7 of [1].
[1] Fritsch, Rudolf, and Renzo Piccinini. Cellular structures in topology. Vol. 19. Cambridge University press, 1990.
https://epub.ub.uni-muenchen.de/4493/1/4493.pdf
See also https://sites.google.com/site/ksakaiidtopology/home/homepage-of-katsuro-sakai/anr.