Your question really is the ultimate question of Oedipus Rex; much of Sophocles' tragedy surrounds the Oracle's prophecy and Oedipus' actions. One of the ultimate tragedies of the play is the way that fate truly works against Oedipus, who at the start of the play, is genuinely active in trying to be a good king for the people of Thebes.
One of the dominant themes of Oedipus Rex deals with the balance of personal choice and natural consequences; Oedipus does act for himself, but unwittingly makes horrendous mistakes. He is a noble man at heart, one who would never knowingly kill his own father and purposefully marry his mother. His revulsion at learning the truth actively demonstrates his severe shame at his actions. Ultimately, fate and extremely unlucky coincidence proves the largest influence in Oedipus Rex.