how is a shirt five yards long and four yards broad, nine yards?
Because the “nine yards” of fabric refers to a length only and says nothing about the width of the bolt those nine yards are cut from.
Naturally, the width of the bolt is a factor in determining the cost per yard, but fabric is sold by the yard, regardless of the width and widths vary greatly. Nine yards of fabric from a bolt 108 inches wide is 27 square yards, but it would still be sold and described as “nine yards” of fabric.
My mother and sister were accomplished seamstresses and trips to the fabric store were a common part of my childhood. They would zip the fabric through a meter with a round dial and then it had a blade that came down and cut a slit and then the saleslady would rip the fabric across the rest of the bolt to “cut” it. I thought it was very cool… when I was something like seven years old.