HanesBrands Inc. is being sold for $4.4 billion to Canadian competitor Gildan Activewear in a deal that would play a major role in consolidating the U.S. basic apparel marketplace.