New author question paraphrased: I have a character and want to give him a famous person's name (or first name). Can I get in trouble for this?
Go for it! Parents name kids after famous people all the time...or nickname them after famous people. Most characters either like it or hate it. Build that into the character. As long as you make it clear you're not talking about the famous person but a character who is named or nicknamed after that person, you are perfectly safe doing it. It sets a cultural backdrop for the story, which may date it, but it's not illegal.
Beyond that, you technically can have a character meet a famous person in the book, but if you say something negative about the real person (or Heavens forbid, libel the person) in the book, you have other legal issues to deal with. Even if you use someone who has been dead for centuries, living descendants can and will file injunctions and lawsuits if their ancestor is represented in a book in a way they feel is not "proper" or "right." Even if you don't see it as a negative connotation, if the family does, they can sue.
Worse, when you're dealing with laws other than US laws, it gets complicated. Some countries do not have "freedom of speech." If you write something negative, even if it's simply personal opinion, the law in some countries will call that defamation of character, even if what you said is completely true and you have proof of it.
But what about Copyright? The person hasn't been dead for 70 years.
Names cannot be copyright (in the US, at least). They can be trademarked, in some cases. For instance, a character name or stage name can be trademarked. But here's what you have to understand about trademark.
Trademark is protection of that name in a very specific industry and for a very specific use. If Action Joe is trademarked as a child's action figure, you can still talk about your 6-year-old character playing with an Action Joe doll. Superman is trademarked, but you can still have one character call another "a real Superman." Evel (thank you, Rowena for the correction...no editor on blogs) Knievel may well be trademarked as his stage name, but if parents in your novel nickname their daredevil son Evel Knievel, you are in the clear.
A prime example here... Harry Potter, the boy wizard, is trademarked. If you want to write a boy wizard, you cannot name him Harry Potter. However, if you write a teen or twenty-something character named Harry Potter, who is heartily sick of the crap he takes because JKR decided to name her character with his name...that's perfectly legal. For it to be illegal, you'd have to infringe on the character, as JKR invented him, a similar background or storyline or something more than just the name. Remember, fan fic (while common) is not legal to distribute or publish without the original creator's permission.
Now, you may run into other complications with naming...not illegalities but technical difficulties. For instance, in Spain, names have to be approved by a judge to avoid the child being embarrassed by the name later in life. This has caused some upheaval of late, since a certain judge blocked an immigrant family from using a name he didn't recognize (but which was common in their home country and was made famous by a Spanish author, no less).
In the same way, in some countries with a royal family, it is illegal to name a child (on the birth certificate) Prince or Princess. Now, you can certainly use it as a nickname, but you can't name a child that.
Names cannot be copyright. There is no public domain, when talking about names. Moreover, there are 6 BILLION people in the world and still more character names. Names will overlap. Just make sure the name is all that overlaps, if you can. Remember the case about the author that wrote the fictitious scumbag music exec and there really was a music exec 20 or 30 years ago with that name, and he sued? And won? That is a major problem.
At the same time, you can parody someone else's character, even if it's not public domain (for US law, death of author plus 70 years). Usually, you change the character name a bit when you parody. Think of things like EPIC MOVIE and work from there. One of my favorite parody novellas was based on the Justice League characters.
Remember that you have to make sure what country's laws something is covered by. What happens in other countries does not always match US copyright law, and the US respects many other countries' laws, via the Berne. My favorite example is the original Peter Pan stories. By UK law, the author was permitted to deed them to a children's hospital. Though, by US law, they would be public domain, they are not. Until the children's hospital ceases to exist...if that ever happens, it will not pass into public domain, and the US respects that legal decision.