“Whosoever believeth” is translated from πᾶς ὁ πιστεύων. It is πᾶς with the singular participle ὁ πιστεύων. So, instead of all it is translated every; thus “everyone who believes” or “whosoever believeth.” Note, “that … should not perish, … have” translates ἵνα along with the subjunctives verbs. This Greek grammatical structure expresses purpose. Thus the purpose of God giving “his only begotten Son” was “that whosoever believeth in him should not perish, but have everlasting life.”
John 3:18 gives the limitation: “but whoever does not believe is condemned already, because he has not believed in the name of the only Son of God.” (ESV) It is true that verses such as John 17:9 and in John 15:16, “You did not choose me, but I chose you” (ESV) are confusing to our human understanding, but we also have John 6:37, “All that the Father gives me will come to me, and whoever comes to me I will never cast out.” (ESV)
Jesus’ wording in John 6:37 alludes to Jesus’ illustrations about sheep, such as John 10:27: “My sheep hear my voice, and I know them, and they follow me.” (ESV) Here’s some background to this verse:
It is not unusual for shepherds to give names to their sheep just as we do with dogs, cats, horses, fish, etc. Every sheep recognizes his own name, and comes when called. Travelers in lands where old-fashioned sheep herding methods are still used, have noticed the readiness with which the sheep of a large flock will recognize the shepherd’s voice. Though several flocks are mingled, they speedily separate at the command of the shepherd, while the command of a stranger would have no effect on them.
Freeman, J. M., & Chadwick, H. J. (1998). Manners & customs of the Bible (p. 518). North Brunswick, NJ: Bridge-Logos Publishers.
Jesus essentially said in John 6:37 that all the sheep (people) the Father has put in his care will come to him, but he also said he will not reject anyone who comes to him. In other words all who choose to come to Jesus are chosen by the Father.
The question of free will is a philosophical problem that isn’t addressed in the Bible, probably because the answer is beyond human understanding. It was a bigger problem for the Rationalists who were Naturalists by the simple fact that cause and effect gives no room for free choice. Problems with Rationalism like this led Naturalism to deny absolute truth and move from Modernism to Postmodernism. But, the Bible does teach that people are responsible for their actions and decisions. Basically, all Christians accept this, but the Rationalists, who are fixed on cause and effect, view people as not responsible for their actions.
Absolute truth exists with God, but we do not know truth completely and our knowledge is limited. We know God is sovereign, but do not completely understand God’s sovereignty.
For we know in part and we prophesy in part, but when the perfect comes, the partial will pass away. When I was a child, I spoke like a child, I thought like a child, I reasoned like a child. When I became a man, I gave up childish ways. For now we see in a mirror dimly, but then face to face. Now I know in part; then I shall know fully, even as I have been fully known. (1 Co 13:9–12, ESV)
God’s revelation in the Bible tells us we are made in the image of God and responsible for our decisions and actions. From the human standpoint we have the freedom to choose. From God’s sovereignty he has chosen us. We don’t understand that, but that’s what we have in the Scriptures. Whoever is everyone who believes. What believe means is another discussion.