So where was Trump not following the law?
The law written by Congress is pretty damn clear stating as it does:
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 [the procedures set forth elsewhere].” 28 U.S.C. § 1158(a) (emphasis added)