The Persian components describe leg clothing, before the bedtime outfit.
Persian pā and jāma combine as leg garment. The word reached English through Hindi and Urdu pājāma, naming trousers before the familiar sleeping outfit.
The scored components are Persian; English did not borrow the word directly from Persian.
Sources
- Merriam-Webster: pajama
Word History identifies Hindi and Urdu mediation and the Persian components.
- Merriam-Webster: pajamas
Definitions retain the trousers sense; Kids Etymology glosses the compound.