With no technical knowledge of music, why can I recognize, say Vaughn Williams or Tchaikovsky?
Humans are excellent at pattern recognition.
A composer’s style is much the same as a writer’s style or a person’s manner of speaking. Even if a person could impersonate a friend of yours voice you may be able to detect the ruse merely by how they talk (what words they normally choose, sentence structure and so on).
Heck, even in the days of the telegraph (Morse code stuff) guys could identify another individual merely by how he tapped out messages (this style was called his Fist). In WWII countries had people who would try to emulate another’s Fist so they could send misleading information.
In comparison recognizing a compser’s style seems easy.