Name signs are typically given to persons within a Deaf community by other members of the community because there is a need to refer to them. Think about the function of a name in any group. A name is a way for a person to be identified and referenced when others in the community need to identify or name the person. As an example, suppose David is my brother and he has not showed up for dinner. Our family is sitting around the dinner table and I ask my father, "Where is David?" I am able to refer to him by his name.
If we are a Deaf family David will be the English name given at birth on my brothers birth certificate but since we all use ASL to communicate we will need a name for David that will be a sign. So David's Deaf parents will have also given him a name in ASL. This will be the way people in the family and in David's Deaf community at school and in his social circles will refer to him. It is because when people talk with others they need a way to refer to David with constantly having to spell out his name. His name sign is his ASL name.
If there isn't a strong and regular need to refer to a person in a deaf community then there is no need for the person to have or be given a name sign. For example if you are just learning sign language and not regularly associating with Deaf people there is no reason for you to have a sign name because Deaf people have no need to talk about or refer to you. If later you work with Deaf people and there will be a need to refer to you then a Deaf person will come up with a unique sign name for you. Sign names are usually given by Deaf people to members of the community. If, as a hearing learner of ASL, you have a close friendship with a Deaf person that person will usually give you a name sign because there will be a need to talk about or refer to you in ASL. If you work at a school for Deaf students you will generally be given a name sign by some other Deaf co-worker because there will be a need to refer to you in ASL when talking with other members in the community.
There are many other fascinating cultural norms surrounding name signs. If you are interested in learning about them, look me up for some tutoring sessions.