To clear up some things… it depends on the cable connected. If your cable is of low quality, which is not an unlikely scenario given the information received in the topic. In most cases when connecting from one output to an interface the cable used is probably going to be long and of low quality. When I say more info needed these are the things that need to be taking into account.
A headphone jack is not supposed to be used for line-out. When you take a headphone jack and bring it up to line level the signal is boosted to line-level and thus noise floor increased. The length of the cable also increases the noise floor. Cables on Headphones are short, are usually gold plated and usually have been optimised / tested for a headphone output which means you will not hear the noise in your headphones when they are of high quality even when they are low quality.
If a headphone output is connected to line in, then one of the first things to do is boost the source audio so the noise floor is negated when increased to line-level. If a cable needs to be long then use a gold plated high quality cable or shorten the distance or don’t use headphone output.