Air handler condensation draining problem
What you’re describing sounds like a combination of negative pressure in the compartment that the drain pan connected to and an incorrectly sized p-trap on the condensate drain.

The depth of the t-prap has to be greater than the negative pressure in inches of water column of the compartment where the drain is connected to. A t-prap with insufficient depth, will prevent the condensate from overcoming the negative pressure which prevents draining until the fan stops.

Further information on sizing of p-traps for condensate can be found in this pdf article: Condensate Traps by Ronald F. Brusha.