It isnt illegal to apply for asylum in the US. Once you do you are entitled to a due process review of your claim. Here is the text of the congressionally approved law:
8 U.S. Code § 1158 - Asylum
(a)Authority to apply for asylum
(1)In general
Any
alien who is physically present in the
United States or who arrives in the
United States (whether or not at a designated port of arrival and including an
alien who is brought to the
United States after having been interdicted in international or
United States waters), irrespective of such
alien’s status, may apply for asylum in accordance with this section or, where applicable,
section 1225(b) of this title.