Are you sure it's a weed? It looks exactly like a carrot - specifically how they look when they grow in the second year, or from a discarded or planted carrot top stub. Like from prepping carrots to eat. I have some outside right now that I"m trying to grow out for seed and to attract butterflies, and they look just like that.
However, plants of the Umbel family can look similar to one another, so you'd want to wait til it blooms to identify it. Umbels of almost all types attract a ton of pollinators, and are food for swallowtail butterfly larvae, too. Those caterpillars look like an assortment of stripey, funny shaped caterpillars, such as this one of a black swallowtail:
That's from this website, an article about raising black swallowtail caterpillars on carrots:
Raising caterpillars from the Enchanted Tree Blog
So if you have room, at the very least if you leave it you might get some neat pollinators in the garden.