Is one allowed to kill flies and other insects, or is this considered cruelty to animals?
It is permitted to kill flies and other insects if they present a nuisance or a disturbance to people. Just as one is permitted to kill animals for their consumption (for positive reasons), so one is permitted to kill insects if they disturb.
Sources: It is clear from the Gemara, and from all later authorities, that it is permitted to kill insects that disturb a person, such as mosquitoes. The Gemara and poskimdiscuss whether the killing of such insects is permitted on Shabbos (it isn’t), but there is no question as to the permissibility of killing them on a weekday.