I try to avoid iTunes as much as possible. I keep my iPhone synced and updated wirelessly so that I don't need to touch Apple's bloated music-and-everything-else app. I usually charge my iPhone overnight by plugging it into the wall outlet next to my bed, but occasionally I want to charge it while I'm working at my PC or Mac.
Thankfully, there is a way to prevent iTunes from opening automatically when you connect your iPhone to your laptop or computer. And as a bonus, I'll show you how to stop the MacOS Photos app from opening automatically, too, when you just want to charge your iPhone from your Mac.
To stop iTunes from opening automatically when you connect your iPhone, open iTunes and then go to Preferences by using keyboard shortcut Command-comma or by going to iTunes > Preferences. Next, click the Devices tab and then check the box for Prevent iPods, iPhones, and iPads from syncing automatically.
If the Photos app also springs forth when you connect your iPhone, then you can quickly put an end to this behavior. Connect your iPhone and when Photos opens, make the sidebar visible by going to View > Show Sidebar. Next, select your iPhone under the Import heading in the sidebar and uncheck the box at the top for Open Photos for this device.
When you install iTunes, a small app called iTunesHelper gets installed along with it. iTunesHelper monitors things in the background and tells iTunes to hop to it when it detects an iOS device. If you disable iTunesHelper, then iTunes remains dormant until you launch it yourself.
To disable iTunesHelper, open the Task Manager and click the Startup tab. Find iTunesHelper on the list, right-click it and then click Disable. After a restart of your computer, iTunes will no longer open automatically when you connect your iPhone.
If you want to return iTunes to its auto-launching ways, just head back to the Task Manager, locate and right-click iTunesHelper and choose Enable.