As others have stated, misfoldings do occur, and the protein is trying to achieve its lowest energy conformation, but the simplest answer is that we don't have a complete answer, hence the desire to come up with a reliable computational solution. We know how certain residues affect tertiary structure, and we know the measurements of secondary structures with a surprising degree of accuracy, but for a protein with potentially hundreds of residues, there are simply too many degrees of freedom to simply tack on amino acids and come up with a structure (although this is essentially the approach that markov chain, monte carlo solutions use).
[This article gives a pretty good synopsis of where computational approaches to the protein folding problem stand.](https://moalquraishi.wordpress.com/2018/12/09/alphafold-casp...)