It is very common for people to struggle to understand how God can foreknow without predestining. The way I understand God is that he exists outside of time and space–that he transcends these things. Therefore, he foreknows things because he knows things. To you and to me, if God foreknows, then he must predestine those things, but this is not the case. God can foreknow without predetermining. We have free will.
Yet, although God does not predestine most things, there are a limited number of things that he actually does predestine. God predestined our salvation and the events surrounding his predestining our salvation were also predestined. So, it was predestined that Jesus would die for our sins, that he would be betrayed for 30 pieces of silver, that Moses would free God’s people from slavery in Egypt and even the small detail that Peter would deny Jesus three times. God predestines a tiny fraction of all human events, and those he predestines have to do with causing us to have an opportunity to be saved. This is the meaning of Romans 9. God is powerful enough and smart enough to give us free will as to whether we will love Him and obey Him, but he predestined our salvation. It is us who choose whether to accept this predestined opportunity to be saved.
So, reality is a mixture of freedom in most things, but predestination in a much smaller range of things. This can be confusing, and your confusion is an example of this. But then again, the fact that it confused you is proof that you are thinking carefully about these things, which is a good sign!
Here is the bottom line: Those God foreknew, he also predestined (Romans 8:29) His foreknowledge precedes his predestination. God knows who will choose to accept his predestined offer of salvation.