This question already has an answer here:
It is said that once a person is dead the atma exits from the body. Will this atma be given to same person born in different form as per karma like animal or bird or it will be given to some other. May be that person will be a bad soul but this atma may be a punya one. Anything mentioned in scriptures in Hindu mythology?