How are you assigned a sponsor in aa?

By asking someone. You're not assigned one, generally you find someone who has good sobriety and some quality that you would like in your life and ask them to be your sponsor, if they say no don't take it personally and move to the next person. You want someone who has done the steps themselves and are willing to take you through them.
You aren't. You have to find your own. In some groups, any "newbie" who comes in will be asked by some of the "old-timers" if they have a sponsor, and in very helpful groups they may recommend a temporary sponsor. Most people go to a meeting several times, and see who they "click" with. It should be someone same-sex with at least a year of sobriety, and you may get several sponsors. Keep working your program.
You are not assigned. A sponsor. The choice to have a sponsor and the selection is yours. If you are heterosexual it is best to have a sponsor of the same gender. If homosexual it is best to have a sponsor of the opposite gender. When emotional & sexual intimacy mix the outcome can be disastrous. Encourage you to consider a sponsor that is experienced, that you can related to but who won't be too easy on you.