That black rubber/plastic piece is called "cowl panel". It
functions like gutters of your house to guide water from the windshield away to the drain system. Now, I see the issue you face. The "cowl panel" is deformed. It flaps while you drive your car, and you don't like it. Your car does not seem a clunker yet. If I were you, I would replace it. It is very easy to replace it. You can replace it yourself.