By default, the auto-brightness feature is enabled on your iPhone. You can disable it if you do not want it.
With that said, let us see the steps to turn on or off.
Enable or Disable Auto-Brightness on iPhone
Step 1: Open Settings.
Step 2: Hit on Accessibility, which you can find between Display & Brightness and Wallpaper.
Step 3: Tap Display & Text Size, which you can find between Magnifier and Motion.
Step 4: Now scroll down to the bottom. Hit the toggle switch beside Auto-Brightness. Keep in mind that the Green means enabled.