When combined, 门外 (ménwài) literally means “outside the door.” Adding 汉 (hàn) personifies this state, creating the “person outside the door” of a particular field of knowledge.
A common mistake is to confuse 门外汉 with the English concept of a social “outsider” (e.g., an outcast, a loner). 门外汉 is strictly about a lack of knowledge or skill in a specific domain. To describe a social outsider, you would use a word like 局外人 (júwàirén).
While similar, there's a subtle difference. A 初学者 (chūxuézhě) is a “beginner” who has already started learning—they have stepped through the door. A 门外汉 is someone who is still completely on the outside, with little to no foundational knowledge. You are a 门外汉 before you become a 初学者.