The extra chromosome results from a random error that occurs when a sperm or egg is formed.
This error causes an extra X chromosome to be included each time the cell divides to form new cells. In very rare cases, more than one extra X chromosome or an extra Y chromosome is included.