ANSWER: This agency scrutinize immigrants at the boarder because, it is believed that the terrorist groups that always attack the US are not citizens of the US, but rather citizens of some other countries that wants to melt down US. Most of the terrorist group in the world today are Islamic groups ( e.g ISIS, Boko Haram, e.t.c) and Islamic religion is not predominant in the US, that is why this agency has also positioned themselves at the boarders to identify terrorist coming from those Islamic countries.
The agency are to secure the Homeland of the US. the US boarders are also part of the US Homeland, therefore it need to be secured against terrorism, as this boarders are the first and easier way to scrutinize and arrest those terrorist groups that are coming the harm people.