Resident in this case means "always there". So the scanner is in memory and running all the time. Which is good. How else could it alert you when something harmfull is found?
Is it only to protect invasion of virus or deletes virus simulataneously?
Basicly, neither of them. The scanner is running. With Avast, as well as many (all?) other av applications it is a on-access scanner. This means that if a file is accessed one way or another it will be scanned and the av software will alert you when something harmfull is found. When the application is giving you the alert it is up to you to decide what to do. Unless you have set it to "automaticly delete" "ignore" or whatever setting you have chosen.