When I did my research with DiD, I saw that when I split the sample to subsample, while the coefficient in the whole sample is significant but this is no longer in the subsample. Can I ask what is the reason behind then?
There can be several reasons.
In case the subsamples are not random, the variable may be significant on a subsample and not on another. This would be a case of omitted variables.
The larger a sample, the stronger the statistical strength of the estimate, because the standard error of the estimator goes down with sample size. So it is quite possible that a non-zero coefficient is statistically significant if the sample is large, but the same coefficient is not statistically significant if the sample size is small.