Individuals with obesity and a history of heart failure (condition where heart does not effectively pump) with a preserved or mildly reduced ejection fraction (measure of the heart's pumping ability) will be eligible for participation. Study participants will have a 50:50 chance to be randomly assigned to either the treatment (NNC0487-0111) or control (placebo) group. NNC0487-011 and placebo will be delivered in an injectable pen device for a subcutaneous, once weekly injection. Placebo means there is no active study treatment) Study participation will last approximately three years and begin with a screening period to ensure correct patient selection. After the screening period, research clinic visits will occur every 4 weeks initially and then every 12 weeks. Some visits may be completed virtually through telehealth or by phone. Study procedures include but are not limited to: blood draws, questionnaires, self injection of study medication, medical history review, vital signs, and electrocardiogram (test that records the heart's electrical activity) The study's primary objective is to demonstrate that study drug vs. once weekly placebo, with standard of care, reduces the risk of a composite heart failure outcome consisting of cardiovascular death, heart failure hospitalization, or urgent heart failure visit in patients with heart failure with a preserved or mildly reduced ejection fraction and obesity.