Andy comes to know that he is not guilty from a new prisoner, which he tries to avoid listening to. Before that even he was doubtful of his innocence. Now after this Andy escapes from the cell in a tunnel he was digging all along. Did the fact that he is innocent made him escape or was it his plan all along to escape?
Andy knew he was innocent. You know, it's this thing that when you know you didn't do it from the start. Because you didn't do it.
Andy didn't knew there was a proof of his innocence so he wanted to get out from the start. Because innocent or not people don't like to be in prison.
Andy comes to know that he is not guilty from a new prisoner, which he tries to avoid listening to. Before that even he was doubtful of his innocence.
You're misreading the importance of the scene. The new prisoner did indeed confirm what Andy could never have been 100% sure of, but, more importantly, the new prisoner's testimony could've prevented Andy from being incarcerated. If only he had been part of the investigation at the time.
This is why Andy doesn't want to listen to the prisoner. He doesn't want to hear about things that could have exonerated him but didn't. It makes him feel even worse about being in prison.
As an example of why that makes Andy feel bad: imagine receiving a phone call from the newspaper shop about the scratch ticket you bought. The newspaper guy tells you that if you had bought the next ticket (instead of the one you did buy), you would've won a million dollars!
Doesn't knowing that you were close to winning make it even worse when you realize that you didn't win?
Similarly, Andy doesn't want to hear about evidence that would've prevented a conviction, because it makes it even worse to realize that he was actually convicted.
You're also giving conflicting information in your question:
- Why did Andy start digging a tunnel before he even knew he was innocent?
- Did the fact that he is innocent made him escape or was it his plan all along to escape?
First, you tell us that he did indeed start digging the tunnel beforehand. But then, you ask whether that's the case or not.
I'm not sure why you think Andy didn't know he was innocent at some stage, unless he was so drunk at the time that he couldn't remember whether he committed the crime, but during his trial he seems very sure of his innocence.
When asked by the prosecutor if he thinks it's convenient that the police never found his gun...
Since I am innocent of the crime I find it decidedly inconvenient.
In any case, the plan appears to have been formed when he tried scratching his name in the wall of his cell with the rock hammer - a big chunk of the wall came off, which revealed that he'd be able to tunnel his way through.