What happens is that lithium-ion batteries have limited charge cycles. Every time you charge and discharge your phone, lithium ions move between the electrodes and generate chemical stress on the internal structure. After hundreds of cycles - in your case, two years of use probably means around 500-700 cycles - the battery loses capacity irreversibly. It's like a spring that gradually loosens until it no longer returns to its original position.
Plus, other factors speed up the wear. Heat is one of the worst enemies; if you leave your phone in the sun, charge it while using it intensely, or it's just really hot where you live, degradation accelerates quite a bit. How you charge also matters: leaving your phone plugged in all night or constantly charging it to 100% stresses the battery more than keeping it between 20% and 80%, for example.
In the Galaxy A52, the battery degrades normally after two years of use. Most manufacturers design batteries to maintain around 80% capacity after 500 charge cycles. If yours is already pretty dead, you've probably accumulated those cycles without too many precautions, or the phone simply got hot. The good news is that replacing the battery is relatively cheap and straightforward on that model.