What are the differences between these two Gabor filter functions
Depending on the location of the peak and the scale of the two axes of the Gaussian envelope the filter may have a large DC response. A popular approach to get a zero DC response is to subtract the output of a low-pass Gaussian filter, which is what the first of these two does. In the case of images, if the DC response is not removed, the filter will respond to the absolute intensity of the image.

This tutorial gives a bit more detail.