The science behind the myth consists of your body dehydrating after you die witch shrinks your body a little bit (Natural Clocks). This website talks about your body dehydrating and how it affects the way your nails appear. Also as your body shrinks your skin gets pulled back and the nail looks like it has grown. In the image everything stops functioning and begins to de-hyrate after you die. But the nail (above the sterile matrix) stays the same length giving the optical illusion that it is still growing.
Although it appears that the nail has grown it really hasn't just the skin itself gets smaller and the nail and hair stay the same length. This gives an optical illusion that the nail and hair have grown. Fingernails and hair do not continue to grown after one's death.
This website confirms that hair and fingernails do not continue to grow after one's death.
Image from