I am not an attorney and any comments I post are not intended, nor should they be construed, as legal advice. If you need legal advice, please consult a legal expert who is familiar with the area of legal expertise you need.
This question comes up a lot in writer/author Facebook groups. There is no easy answer and the reasons to use or not use a pen name are as varied as you can imagine. With the rise of stalkers these days – think the 1990 movie Misery – https://www.imdb.com/title/tt0100157/, this is a good reason to use a pen name. Others write genres or sub-genres that might cause issues with an employer or a particular line of work if self-employed. Other authors write in multiple genres or sub-genres that appeal to different readers.
In the U. S., you can opt to register your pen name with the Copyright Office anonymously or with your real name attached. There is a small disadvantage to doing it anonymously as the copyright laws are slightly different. The difference is minor enough to not be an issue. The downside to attaching your real name to the pen name is the ability to search your real name is possible.
Here are some good links:
https://writebrilliant.com/using-pen-name-risk-writers-shouldnt-take/ (a different take on why you shouldn’t use a pen name)
https://annerallen.com/2017/10/author-pen-names-digital-age/ (another anti-pen name article)
There are plenty of other articles extolling the virtues of using pen names or warning against using pen names. However, many of the reasons for or against are covered by the above links.
Ultimately, there are good and bad reasons to go the pen name route.