I believe the main difference is that well is an adverb and good is a noun/adjective. Something like "you did well" would mean you did a good job of doing; here, well is the adverb describing the action 'did'. In something like "you did good", good is the noun being done. I guess you could add some words and say "you did a good thing." It's the same in both sentences. "you [subject] did [verb] good/a good thing [noun]."
There's a saying I heard, which I'll probably butcher here, that goes something like "Normal people do well, superheroes do good." Dunno if that helps or not, but there it is.
In addition to what Ulrimomorb said, a mnemonic I used as a kid was this:
Superman does good, and fights well.
You can "do good" and "do well."
If someone "does good," it means that they do good things (feed the homeless, help old ladies cross the street, donate to charity, etc.)
If someone "does well" it means that they are healthy or that something going in their favor. (John does well on his tests.; How are you? I am doing well, thank you.)
If you want to modify any other verb, you will use "well".
Ultimomorb is right. I'll add that in colloquial English and greetings, they are sometimes used as equivalent. "How's it going?" "Good." In a greeting, most Americans won't care that you've put the adjective instead of the adverb. However, when a native speaker says "He did good," when he means "He did well," he doesn't sound very educated. Plenty of American English speakers use this, like in the Philadelphia area where I live, so you'll run across it. But if you're foreign, using "well" correctly will make a good impression, even on those who themselves use "good," (it will sound as though you're educated, and you care about our language) so it's not worth picking up "good" just to be colloquial.
In English, adverbs tend to go before the verb or after the verb+object. Putting the adverb in between the verb and the object is seldom done.
S -V-- ---O--- Adv
I know the city well.
S -V-- ----O--- ---Adv---
I open the door carefully.
S --Adv-- --V-- ----O----
I carefully open the door.