That’s a question asked in connection with the doctrine known as Calvinism that teaches that God sovereignly saves some, but not others, that the ‘others’ are created already predestined to an eternity in Hell.
Many, if not most who ask the question hold to the doctrine known as Arminianism, which would tell us that a loving God would never create anyone whose ultimate end is Hell. They also realize that God does have a ‘chosen’ or ‘elect’ people, because to deny that would be to deny the Bible. They define the chosen/elect as those whom God knows will at some point in their lives choose Christ.
Well, if God knows who will choose Christ, He also knows who will eventually reject Christ, and spend an eternity in Hell. And if God creates those He knows will reject Him, isn’t he creating persons doomed to hell?