Battery swelling is not caused by iOS itself, nor does it normally happen suddenly in a single day. A swollen battery is generally the result of gradual internal deterioration or damage to the battery cells, which may have been developing for some time before the swelling became visible.
In some cases, the deterioration can be accelerated by excessive heat, a faulty or poor-quality charging cable, a defective charger/power adapter, unstable charging equipment, physical damage, or prolonged exposure to high temperatures. However, it is not possible to identify the exact cause simply from the fact that the battery has swollen.
You may also have noticed warning signs earlier but not connected them with the battery—for example, unusual heating while charging, charging becoming intermittent or unusually slow, the battery draining faster than normal, unexpected shutdowns, or the phone failing to charge properly. These can be indications that the battery was already deteriorating.
An iOS update does not normally cause a physically swollen battery. An update can temporarily increase processor activity and battery usage while the system performs tasks such as indexing and optimization, which may make the iPhone feel warmer or cause increased battery drain for a short period. That is different from causing the battery cells to physically swell.
Therefore, if swelling is discovered shortly after an iOS update, the timing does not by itself establish that the update caused it. The underlying battery deterioration or damage would generally have started earlier, even if the visible swelling only became apparent later.
If the battery is visibly swollen, stop using and charging the iPhone and have it inspected by Apple or an authorized service provider. Do not press on the swollen area or attempt to open the phone yourself.