No, this is false.
The University of Arkansas Medical Services debunks this myth:
Hair and fingernails may appear longer after death, but not because
they are still growing. Instead, a persons fingernails and hair may
appear longer because the skin around them has retracted, according to
the Dermatology Clinic at UAMS.
After death, dehydration causes the skin and other soft tissues to
shrink. This occurs while the hair and nails remain the same length.
This change in the body creates the optical illusion of growth people
The BBC also makes a similar debunking:
So why do myths persist about stubble growing on dead men’s chins and
fingernails lengthening? While such observations are false, they do
have a biological basis. It is not that the fingernails are growing,
but that the skin around them retracts as it becomes dehydrated,
making them appear longer. When preparing a body, funeral directors
will sometimes moisturise the fingertips to counteract this.