LUHE, asylum seekers must apply for protection in the country of destination—meaning they must arrive at or cross a border in order to apply. It is only when their application (and any appeals) are rejected that they become an illegal immigrant if they then remain in the country.
It would be possible for an illegal immigrant to seek asylum, but they would have to prove to the authorities that they meet the criteria to be covered by refugee protections. This could happen, for example, if the government in the country of origin changed while the immigrant was legally here and he would now face persecution if he returned.