Tom Hanks had no idea what was going on while he filmed 1994 classic Forrest Gump.

The actor portrayed the titular character, a slow-witted but kind-hearted man who witnesses and unwittingly influences several defining historical events in the 20th century in the United States, in the Robert Zemeckis-directed movie.

But while Forrest Gump won six Oscars, including Best Picture and Best Actor in a Leading Role, Hanks has now admitted he was shocked by the flick's success.

"We wondered what we were doing, and we wondered if it was all going to make any sense," he laughed to an Entertainment Tonight reporter at the Los Angeles premiere of Toy Story 4 on Tuesday. "Any movie that you're making requires two things. One, a huge leap of faith in the alliance you've made with everybody else who's making the movie, and also trust in the process somehow, and that if you love it and you do your due diligence, and you never let go of the potential that it could be made, it will all work out.

"Fact is, that was a magnificent movie and a surprise either way. I think the reasons that it has lasted, (is) it's accurate both to who we were back when it first came out and who we are still today."

Elsewhere at the Toy Story 4 debut, Hanks spoke about voicing cowboy toy Sheriff Woody for the fourth instalment and the similarities between himself and the character.

"I am a team player. I love being part of an ensemble, and I think we are always in this together somehow," the 62-year-old said to PeopleTV reporters. "Anybody can make it a miserable day by being cranky or self-centred or thinking that it's all about them instead of all about the whole."

Toy Story 4, also featuring the voices of Tim Allen, Christina Hendricks and Keanu Reeves, hits cinemas from 20 June.