What is autophagy? How and under which circumstances is it used by the cell? I believe The reason for autophagy is some kind of recycling, am I right? But why does it occur in infections?
Autophagy is a cellular process that is occurring all the time, but it can be elevated during times of need (see below).
In autophagy, cargo (can be anything - mostly macromolecules but also bacteria/viruses etc) is taken up by a lipid membrane which folds on itself to form an autophagosome, which is like a vesicle but have markers on it that makes it specialized in carrying out autophagy. These autophagosomes are then transported to, and merge with, lysosomes, releasing the cargo into the lysosome to be degraded. The broken down materials are then released back into the cytosol, where other processes can make use of them. That is the "some kind of recycling" you are referring to.
There are two types of autophagy - selective and general. In selective autophagy, receptors on the membrane of the autophagosome specifically selects for ligands (e.g. p62, ndp52 selects for ubiquinylated substrates, which usually marks molecules for degradation). In general autophagy, the uptake into the autophagosome is random.
So, you can think of general autophagy as maintaining a basic level of turnover - to ensure everything in the cell is not worn out; and selective autophagy as a response to specific ligands that needs to be degraded.
By this logic, autophagy activity increases during infection because those infectious agents, once gaining entry into the cell (either through phagocytosis or by forced entry), will need the autophagy machinery to transport it to the lysosome to be degraded. Interestingly, some bacteria actualy hi-jacks this process to ensure its survival in the cell. Here's a good review to get you started if you are interested.
Note that the proteasome also recycles macromolecules, although the things it can recycle is limited by size.