Shakespeare did not write this phrase in Macbeth but may have alluded to it in Hamlet: "Something is rotten/stinking in the state of Denmark." The phrase seems to be a ancient Chinese, Greek or Turkish proverb. It was used as a metaphor to describe corrupt governments.
Today, it is often used to describe dysfunction in corporate or business situations; that is to say, with poor management or ownership, everything else (below) is going to be poor too since the problem originates at the top. It is entirely possible that Shakespeare used a variation of it as a metaphor to describe corruption in Denmark.
References
I didn't find the phrase in Shakespeare's plays, but I did find some information that might interest you. The article "On Language" from The New York Times suggests that that's what Shakespeare alluded to by "something rotten in the state of Denmark" and that he used "rotten" to emphasize the corrupting secret crime committed by Claudius.
Professor Michael Delahoyde of Washington State University writes that in Macbeth, in Act 5, scene 3, that, through Macbeth, Shakespeare "reflects on the inability of medical science to cure the disease of a nation (V.iii.50ff)" even though Macbeth fails to "recognize that a fish rots from the head down."
Macbeth: Doctor, the thanes fly from me.
... If thou couldst, doctor, cast
The water of my land, find her disease,
And purge it to a sound and pristine health,... (V. iii)
Get Ahead with eNotes
Start your 48-hour free trial to access everything you need to rise to the top of the class. Enjoy expert answers and study guides ad-free and take your learning to the next level.
Already a member? Log in here.
References