Namespace pollution occurs when multiple modules have functions with the same name, causing confusion and potential errors when calling those functions. This can happen when using import * or when naming functions without proper consideration for naming conflicts.