The actual registering of the name is not illegal.
However what you do with the domain after you register it could be.
Like offering it for sale, parking it, developing it into a website for profit, placing damaging content on a website.
In the case of famous people its called profiting from someone elses intellectual property ( Infringement ).
You could, however, make a non-profit fansite, which most celebs tolerate, but there is no guarantee that they won't come after you.