Bird nests function as vessels for eggs and nestlings, and an environment for rearing offspring. However, foreign objects falling into bird nests and nestling eggshells may be harmful. Moreover, the smell of fecal sacs increases the risk of detection by predators. Many bird species have evolved nest sanitation to prevent damage to their nests. Furthermore, egg rejection evolved in some birds to thwart brood parasites that lay eggs in their nests. We studied 133 nests of barn swallows (Hirundo rustica) in an island population through a nest content manipulation experiment to determine nest sanitation and egg rejection behaviors and their relationship. Swallows rejected non-egg foreign objects more frequently (100% vs. 58.6%) and sooner than parasite eggs, which supports the hypothesis that nest sanitation is a pre-adaptation to egg rejection. However, nest sanitation did not increase egg rejection, either in probability or latency. Furthermore, both sexes incubated the eggs, cleaned the nests, and removed parasite eggs, implying that both are confronted with natural selection related to nest sanitation and brood parasitism. However, females invested more time in these behaviors than males. This provides evidence for the evolutionary relationship of nest sanitation and egg rejection behaviors in barn swallows.