It means to stop something at an early stage before things worsen.
Example: My cat has started peeing in places other than the cat litter. I’ll have to bring my cat to the vet and see if she has any advice to help me nip this in the bud.
I was curious about the origin of this idiom. Turns out it’s quite old (early 1600s) and quite basic.
It “stems” from gardening.
A flower that is “nipped in the bud” won’t grow or blossom. So as the expression suggests, if the situation is handled when it is only a minor or small problem, it won’t “grow” into a major problem.