Tom Hanks gave a GREAT speech at Michael Clarke Duncan's funeral ... retelling a story M.C.D. had told him about why the enormous actor joined (and then unjoined) a Chicago street gang when he was a kid.

Hanks -- who co-starred with Duncan in "The Green Mile" -- had the crowd roaring with laughter ... a touching tribute to his old friend.