Whenever you have more than one network connection, it’s possible you’ll end up w/ more than one default gateway. And that can screw up your internet access if the default gateway that’s NOT connected to the internet has higher priority than the default gateway that IS connected to the internet. IOW, your PC is confused because it’s getting conflicting/contradictory information about which network is the one that provides access to the internet. But once you disconnect the PC from the network that’s NOT connected to the internet, that conflict is resolved and internet access returns.
The easiest way to avoid this problem is to use a static IP configuration on the network that’s NOT connected to the internet, and simply don’t include a default gateway IP. Another option is to leave the configuration as is (i.e., using DHCP), but specify a higher metric on the TCP/IP configuration for the network NOT connected to the internet (e.g., 100) than the one connected TO the internet (which usually defaults to 1). The higher the metric, the lower the priority.