In Great Britain we write "pyjamas".
In the U.S.A. it is "pajamas".
The spelling is probably not important (except that the British are correct (lol).
The word has its roots in Persia. Wikipedia will tell you all about this.
Who wears pyjamas these days? Not many. In fact when I moved to SRQ and spent a few nights with my pals Ben and Bruce I emerged one morning wearing them. Ben stated that he had once seen such garments in a museum!
Ben and I apart there must be a market for pajamas in these United States. At this time of gift giving I often hear radio advertisements from the Pajamagram Company which offers matching pajamas for all the family.
Horrors! Who could imagine sitting down for Christmas Day breakfast with Grandma and Grampa, and Mum and Dad, and older sister, and younger brother each wearing matching jammies.
That would put me off my bacon!
What is worse is that Pajamagram company also offers matching p.j's for our cats and dogs. See:
"Bloody Hell" as we say in the U.K. - these are products for the jaded and indolent rich.
(And homeless children sleep under railway bridges).