Yes, but indirectly.
The ECU controls your ignition timing, injector timing, and fuel/air mixture. My old carb-and-distributor Corolla would require adjusting screws in the carb and manually adjusting the distributor with a timing light, but most modern cars replace those carb adjustment screws and the distributor with a computer.
Under normal conditions, the engine computer learns and improves. I can’t help but recall when Sport Compact Car took their “daily driver” Subaru WRX to the dyno. They strapped it down, did a few pulls, disconnected the battery for a few minutes, then did a few more pulls. It turned out that once it forgot about their ~30k miles of lead-footing, the thing lost a little MPG… and about 20-something horsepower, or about 10%. So forgetting the settings can be a bad thing. And unless the engine is brand new, odds are that the default settings that it reverts to after reconnecting the battery are pretty far off from what the engine actually needs to run correctly; the older the engine, the more off it will be.
However, when conditions are sub-optimal, it can learn bad habits as well. If your alternator is wonky, it won’t get the clean 12-volt power, and computers do “interesting” things when their power supply (which, on cars, is generally the alternator; the battery is pretty much just there for starting) is crap. For instance, if the computer decides to fire off the plugs too early, you get something like this; a kind of knocking sound. Or maybe the sound was the alternator bearings going out. In either event, firing the spark plugs too early or too late can affect MPG, as can having the computer telling the injectors the wrong things and screwing up the mixture.
Once the ECU gets a steady 12v instead of whatever it was getting before, it will function properly and tell your engine to do the right things; the ignition timing will be properly set and the mixture will be far closer to optimal. And if the timing and mixture are right, the engine will run stronger and more efficiently than if it’s all out of adjustment due to a “drunk” computer.