In traditional Christian theology, God's omniscience means that God knows everything that can be known. There are no gaps in his knowledge. No mysteries to be discovered and nothing to learn. But there are things that can't be known because they're nonsensical. God's omniscience doesn't mean that he knows what a three sided square looks like or how to divide by zero (except when it's defined by convention as in IEEE 754).
In traditional Christian theology God is also said to have free will, though there are more qualifications and disagreements about what exactly that means than for omniscience. In Reformed Protestantism I think God's free sovereign will can be described as God being completely free from any external compelling will, but at the same time that he always wills and acts entirely true to himself. (Most other branches of Christianity would mostly agree with this.) As God's character is that he is loving, truthful, and just, everything he does reflects those aspects of his character. But within the "boundary" of never being inconsistent with who he is (hence his immutability), there is much that he is completely free to choose. For example, there is no inherent reason why the solar system we live in has to have eight planets. Seven planets would have been fine, as would nine or ten. God's decision to create our solar system with eight planets (and thousands of dwarf planets etc.) can accurately be described as a "free" choice.
So how do these two doctrines interact? You're right that on the surface it does seem as if they are in conflict. If God knows all, then that would include all his choices, so wouldn't that mean that to be true to himself there is only one set of choices he can make?
This is one time where we are limited by our nature: we cannot understand how God exists as a timeless being. Even his decision to create the universe was a free choice, for he was under no compulsion to do so, although creating people for him to love is entirely consistent with his character. Having decided to create the universe there were no physical or logical reasons which compelled him to create an eight planet solar system, and its hard to conceive of a reason why that would be part of his character. So I have to conclude that there are many possible universes that he could have created, and that he knows everything about those alternative universes that can be known. The future is what he knows will happen because out of all the possible futures this is the one he has chosen. But I don't think we should think of God's will being constrained by his foreknowledge. It may be better for us to think of God's omniscience and his choices as being "concurrent", although concurrency is not something that applies to a timeless being.
Wherever there is more than one possible reality (such as the number of planets in our solar system), that is proof that God's will is active. As the only self-existing being (the doctrine of Aseity) everything else is contingent on God, and so must depend on him as the ultimate cause, and where there are possible alternatives they must depend on his will.
In these quotes from the Westminster Confession of Faith we can see Reformed Christianity's teachings on God's omniscience, free will, and that he does not will because of his foreknowledge.
God has all life, glory, goodness, blessedness, in and of Himself; and is alone in and unto he himself all-sufficient, not standing in need of any creatures which he has made, nor deriving any glory from them, but only manifesting his own glory in, by, unto, and upon them. He is the alone fountain of all being, of whom, through whom, and to whom are all things; and has most sovereign dominion over them, to do by them, for them, or upon them whatsoever himself pleases. In his sight all things are open and manifest, his knowledge is infinite, infallible, and independent upon the creature, so as nothing is to Him contingent, or uncertain. He is most holy in all his counsels, in all his works, and in all his commands. To Him is due from angels and men, and every other creature, whatsoever worship, service, or obedience he is pleased to require of them. (WCF 2.2)
God from all eternity, did, by the most wise and holy counsel of his own will, freely, and unchangeably ordain whatsoever comes to pass; yet so, as thereby neither is God the author of sin, nor is violence offered to the will of the creatures; nor is the liberty or contingency of second causes taken away, but rather established. (WCF 3.1)
Although God knows whatsoever may or can come to pass upon all supposed conditions; yet has he not decreed anything because he foresaw it as future, or as that which would come to pass upon such conditions. (WCF 3.2)
God the great Creator of all things does uphold, direct, dispose, and govern all creatures, actions, and things, from the greatest even to the least, by his most wise and holy providence, according to his infallible foreknowledge, and the free and immutable counsel of his own will, to the praise of the glory of his wisdom, power, justice, goodness, and mercy. (WCF 5.1)
So according to traditional Reformed Theology, these two doctrines are to be upheld alongside each other, without conflict, and without one being dependent on the other. What is not said is how the timeless God experiences his omniscience and his sovereign will.