Although I don't quite remember the exact scene where it is told, I remember the joke rather well and always liked it. It relates to the film's general themes quite nicely.
The film is primarily about Chris Gardner fighting the odds and working himself literally from rags to riches. This is also reflected in the film's very title, relating to the classic American right to "pursue your own happiness" and the idea of the "American Dream" that you (or anyone) can make it if only you work hard and fight for your dreams.
And along these lines the joke is to be interpreted too, I think. It tells the story of a man who blindly relies on others (or rather God) to save him, without recognizing the chances he got offered to save himself. It emphasizes that you have to look out for yourself and that it is on you to work for your dreams (or save your life). Yet notice that the joke still doesn't deny God (or anyone) looking out for you and offering help. But even while God/fate/life may give you chances, you still need to recognize them yourself and grasp them, it isn't done with just waiting for success to happen. So the man maybe isn't representing Gardner himself rather than someone antithetical to him. The moral of the joke, according to the film, would be to not be that man.
And although it's a joke and we don't have to take God literal rather than as a metaphor for the forces of life in general, it also fits quite well into the Puritanical work ethics of believing in God while working hard that the American Dream was ultimately founded on.