STM32L4 USB Device with VBUS Sensing
VBUS sensing is a must feature for self-powered slave USB interface, to prevent drive-back voltage on D+ wire until the u-B cable is plugged in and VBUS is present. This has nothing to do with clocks, clocks should have no difference in both cases.

The STM32L4 Discovery Kit is a fairly sophisticated IoT/SoC device. It has many options, complex OTG USB function, battery-powerd, self-powered, ST-LINK powered, etc. For the VBUS sense to work, at least no jumpers should be in JP4 2X5 header, and USB_OTG_FS_VBUS sense signal is already wired in. The only one thing looks strange - VBUS has +5V, and it goes directly to GPIO of low-voltage MCU without any level translation. Might be 5V-tolerant, but strange.

So the problem is likely in software configuration that handles the USB_OTG_FS_VBUS pin and enables USB stack.