What causes a secondary infection of candidiasis to the lung?

It depends... First, it must be said that just because candida is found in a sputum culture, it does not mean that a person has a candidal infection- this yeast is typically a colonizer and can be mistaken as a culprit . However, in the approrpiate context, profound immuno-suppression (organ transplant or else, bone marrow transplant patient) creates a situation where candida can be an opportunistic infection.
Immune. Your immune system is working abnormally. This can occur in HIV infection.