That was from John 15:16, but...
I hope you read
all of chapter
John 15.
2. Every branch
in Me that does not bear fruit He
takes away
14 You are My friends
if you do whatever I command you.
Jesus died for the whole world, but not all of the world will remain and not be lopped off because they did not keep the commands of Jesus.
Partial truths taking one verse out of the context of the whole like many have done produces heresies. Two heresies in the Church are Universalism and OSAS.
16 is the verse in question saying "You did not choose me, but I chose you and appointed you so that you might go and bear fruit—fruit that will last..." keeping with theme in the text it opens showing us that branches are cut down that don't bear fruit and those that do bear fruit are pruned. Implicit in this is choosing a branch over another based on the amount of fruit it bears.
However, if we want to stick strictly with the metaphors presented verse 1 establishes who has what role saying "I am the true vine, and my Father is the gardener." So the vine is Christ, Christ doesn't identify himself with the role of the gardener that cuts down branches or prunes he is the vine. So who are we? Our role is identified in v5 saying "I am the vine; you are the branches. If you remain in me and I in you, you will bear much fruit; apart from me you can do nothing."
So the Father is the gardener, Christ is the vine and we are the branches. When Christ speaks of choosing us in context, based on the themes presented in the text, his choice is based on the roles of the vine to the branches (not gardener to branch). And we see that if we want fruit we need to remain in Christ and he in us.
So here is a summary:
Our role as the branches are to remain in the vine.
The vine's role is to remain in the branches so that if they remain also in the vine they will bear fruit.
the gardener's role is to cut down the branches that are not bearing fruit and to prune those that are.
Christ's "choosing" is likened to Christ remaining in the branches. If he does not remain in the branches the branches cannot produce any fruit (apart from me you can do nothing) and will be cut down by the gardener. So how does Christ choose? There is a lot of parallels going on in the text and Christ slowly unravels it leaving us with more and more information as he goes on. v9 is part of the unravelling saying "As the Father has loved me, so have I loved you. Now remain in my love" this "remain in my love" part is paralleled with "remain in me and I in you" and gives us further clues as to how we can remain in him. so what does it mean to remain in his love? v10 tells us "If you keep my commands, you will remain in my love, just as I have kept my Father’s commands and remain in his love" so to remain in Christ and he in us we must keep Christ's commandments.
This seems simple enough except it is still carefully worded saying "If you keep my commands, you will remain in my love..." It's not "when you keep..." it's "if you keep..." What this reveals is that Christ loves us first and in order to remain in that love we need to keep his commandments. We don't draw Christ to us through our obedience (works based) because Christ already loves us and he already has chosen us, But in order to remain in him, we must keep his commandments.
So back to the question... how does Christ choose us? The text may not tell us. The text tells us that branches that do not remain in Christ will not bear fruit and will be cut down by the gardener. The text tells us that Christ's choosing is first and our obedience is the condition to remain in his love but it is not based on Christ selecting us. What can be argued is that Christ implicitly chooses us using language that can be widely applied and indicate to the hearer that they are the ones chosen. I would agree with this too as this is the gospel, the good news, and written in a way to be widely received and personal upon hearing it, if not, this passage is written misleading the person receiving the gospel that they are chosen too.