Media playback is unsupported on your device
Media captionEC president Ursula von der Leyen said the bill breached the UK’s previous commitments.
The EU has begun legal proceedings against the UK after it refused to ditch plans to override sections of its Brexit divorce deal.
An EU deadline for the government to remove sections of the Internal Market Bill expired on Wednesday.
The “letter of formal notice” could eventually lead to a court case against the UK at the European Court of Justice, the EU’s top court.
But the EU has not walked away from talks over a post-Brexit trade deal.
European Commission President Ursula von der Leyen said the UK would have until the end of November to respond to the EU’s concerns over the draft legislation.
UK-EU trade talks are continuing in Brussels this week. Prime Minister Boris Johnson has said both sides should “move on” if a deal was not reached by mid-October.
- Government’s Brexit plan gets MPs’ final backing
- EU ultimatum to UK over Brexit talks
- What are the sticking points in Brexit trade talks?
In a brief statement, Mrs von der Leyen said the bill was a “full contradiction” of previous UK commitments over how a hard border on the island of Ireland should be avoided.
She added that the bill was by its “very nature a breach of the obligation of good faith” contained in the withdrawal agreement that took the UK out of the EU in January.
A spokesperson for the UK government said the bill was a necessary “safety net” to protect trade between different parts of the UK.
They added the government would respond the EU’s letter “in due course”.
What powers does the EU have?
Analysis by Nick Beake, BBC Brussels Correspondent
Although the headline is dramatic, this was the EU’s next logical step.
When it fired the UK an ultimatum to scrap the most controversial parts of the Internal Market Bill by the end of September, it knew it would likely have to follow up on its threat. And now it has.
But any legal path is long and unpredictable – with no resolution likely to come before the UK’s transition period ends on 31 December.
The legal advice given to the EU member states has been that for any alleged breach of the withdrawal agreement committed in 2020, they would have a further four years to pursue the UK.
For any alleged breach committed after the transition period, the EU could use the dispute settlement mechanism (which both sides agreed to in the agreement) to penalise and fine the UK.