The one stems from the e-privacy directive which stems from 2002, the other is the GDPR.
https://en.wikipedia.org/wiki/EPrivacy_Regulation
https://en.wikipedia.org/wiki/General_Data_Protection_Regula...
https://edps.europa.eu/data-protection/data-protection/gloss...
https://gdpr-info.eu/