Company Y.
Technically, they're the ones who signed the contracts with the third party, and the Designer X was "part" of company Y at the moment, unless designer X signed a contract with his employer company Y stating that he keeps the rights of his artworks.
But if company Y doesn't mind or upon agreement, designer X can be cited for his work. Or both designer X and company Y. Citing is not the same as claiming the rights but the company would be in full right to demand the name of designer X to not appear as creator of the artwork.
"If the work is for hire, "the employer or other person for whom the
work was prepared is considered the author and owns the copyright."
(The seminal case in this conversation is the Supreme Court case,
Community for Non-Violence v. Reid (1989).)
Across architecture, industrial and graphic design, the policies
remain generally consistent—the firm owns all employee intellectual
property.
Source, other source and other source on permission.
Note for designers
It can be possible to keep these rights as author of your artwork but this needs to be done on a written contract when the designer is being hired. Usually companies and firms add a special clause about this or forbid the designer to cite his work for X amount of years. If it's only a matter of using the work for a portfolio, this can easily be negotiated and it's not the same as requiring the rights, but a permission to show your artwork.
Then again, this might not be possible if the firm has a special agreement about this with its own client!
Even freelancers have to be careful with this, some clients may require on the contract the same privileges as employers (work-for-hire.)
Note about license and copyright
The right to use (license) and intellectual property (copyright) are not the same things.
Non-exclusive License: Unless specified otherwise on a contract, when an artwork is ordered by and paid by a client, it's implied there is a non-exclusive right to use the artwork. This gives the company and the original author/creator a "shared" right to use the artwork. The designer can freely use the artwork for a portfolio and resell it if there's no copyright infringement (eg. brand), for example. The creator of the artwork is still the one who owns the intellectual property of the artwork but gives a permission to use the artwork to the person who pays for its creation. An example for this: Royalty-free stock pictures.
Exclusive License: It's a monopoly on the license and an exclusive permission to distribute the artwork but the intellectual property remains with the author/creator. This is usually negotiated on a period of time. An example for this: book publishing or a picture created for a specific event.
Copyright/trademark: This is the intellectual property and can be registered. The party owning this right can do anything they want with the artwork (resell, publish, distribute, resell, modify, etc.) When a designer work-for-hire or sells all the rights of his artwork, he doesn't own any rights or license on the artwork anymore and cannot re-use it in its current form. Rights stays with the creator or right holders up to 75 years after his death unless they are transferred to someone else. An example for this: a logo, a song or special attributes of a brand.