Flies are pretty common as far as household pests go, but they can be quite difficult to get rid of. The first thing you need to know is that flies feed on trash, old food, animal feces and other decomposing matter. So here's what you need to do: Clean up!
Get rid of old bags of trash and make sure the kitchen is tidy. That will keep new flies from being attracted to your apartment. You can also ask your landlord to beef up your weather stripping, or put small packets of crushed mint leaves near windows or doors.
There are also a number of ways to get rid of the flies you already have. Fill a jar with apple cider vinegar and cover it with a tight-fitting paper funnel secured with tape. The flies will be attracted to the vinegar and fly into the jar, but they'll be unable to leave. Hanging plastic bags full of water outside your apartment will also help to repel flies -- the flies think it's a predator and will stay away.