The iPhone XS battery, as well as that of the iPhone XS Max, consists of two different lithium-ion cells formed in the form of an L (in the phone, not on your forehead).
By joining a large battery instead of two, you can remove a small amount of packaging and remove the small space between them, maximizing your capacity. Picture two small train cars in a row. In addition to that, put another car that is as long as both small cars combined. You can fit more in the single because you eliminate two walls and some space. The same principle applies.
We all tease Apple that all its products become thinner, but it requires incredible technical delights to actually do that. Featured image credit goes to iFixit.
: How Apple designed the iPhone XS battery