Can congestive heart failure be from a bacterial infection of vital organs?

Not usually. Except in the case of bacterial infection of the heart valves (endocarditis) or septic shock , this would be very unusual.
See below. Bacterial infections do not cause congestive heart failure except for endocarditis with severe valve dysfunction or pericarditis with cardiac tamponade. In patients with pre-existing CHF a bacterial infection can precipitate a decompensation and worsening of the chf.
Agree with. Dr ein bit would add that advanced sepsis can can myocardial suppression and resultant chf.