From Persian 'pāy' (leg) and 'jāma' (garment), via Hindi/Urdu 'pāyjāma,' 'pajamas' entered English through the British colonial presence in India, transforming from a versatile South Asian everyday garment into the Western world's default sleepwear.
Loose trousers and a matching jacket or top worn for sleeping or lounging; originally, loose lightweight trousers worn in South Asia and the Middle East.
From Hindi/Urdu 'pāyjāma' (پاجامہ), a compound of Persian 'pāy' meaning 'leg' and 'jāma' meaning 'garment' or 'clothing.' The word entered British English through colonial contact in India, where loose-fitting trousers — worn by men and women across South Asia, Central Asia, and the Middle East — were adopted by British colonists as comfortable nightwear and informal daywear. The garment reached Britain and then America in the nineteenth century
The spelling difference between American 'pajamas' and British 'pyjamas' reflects nothing more than divergent orthographic conventions; both forms were used interchangeably in nineteenth-century English before the Atlantic divide solidified.