Read more about this weirdo in this article from ScienceNews, written by Susan Milius: https://www.sciencenews.org/article/sea-slug-detached-head-crawl-regenerate-grow-new-body (last accessed on 15.03.2021).

This process takes some time, so it is suggested that this is not a mechanism to escape predators, like some lizards do, but rather to escape parasites.