The agreement marks yet another significant outgoing for the Blues in a hectic transfer window.
The 22-year-old Portuguese defender is expected to sign a seven-year contract with the Spanish club.
Veiga only joined Chelsea last pre-season from FC Basel in a 12 million pound deal but struggled for game time, making just one Premier League start. He did feature 18 times overall, scoring twice in the Conference League against Gent and Astana, and was part of the Portugal squad that won the Nations League final against Spain in June, appearing as a substitute.
Midway through the season, he requested to switch from left-back to centre-back - a move that led to tension with Chelsea management. He was later loaned out to Juventus and returned to find himself training with the club's “bomb squad" - a group of senior players considered surplus to requirements under new manager Enzo Maresca.
The sale of Veiga takes Chelsea's total income from player sales to over 250 million pounds, helping to offset their 277 million pounds spending on nine new arrivals.
Veiga will become Chelsea's 11th departure of the window, following notable sales such as Noni Madueke to Arsenal for 48 million pounds, Joao Felix to Al-Nassr for up to 43.7 million pounds and Kiernan Dewsbury-Hall to Everton for 28 million pounds
Meanwhile, Chelsea are still active in the market, eyeing potential moves for Alejandro Garnacho from Manchester United and Xavi Simons from RB Leipzig. They are also working to offload more players, including Nicolas Jackson, Christopher Nkunku, Raheem Sterling, Ben Chilwell, and Axel Disasi.