A lot of people struggle with affect vs. effect, but let's assume that you've got the difference down cold: Affect is a verb (usually), and effect is a noun (usually).
But how did it happen that two clearly related words, one a verb and the other a noun, are distinguished only by a difference in spelling that doesn't make a difference in the pronunciation?
It could have been different. For the verb affect, we could have had the noun form affection. Oh, wait — we do. Unfortunately, it's the noun form for a meaning of affect that we don't have anymore: to have a liking for something.
Well, then, how about affectation? That's the noun form for a meaning of affect that we still do have: to deliberately aim at something, like a British accent, or an air of amused detachment. But it doesn't cover "the act of affecting something," which is the meaning we're after.
What about a change in the stress, pronouncing the verb "af-FECT" and the noun "AFF-ect"? Shoot! Once again, we already have that noun, and once again, it doesn't have the meaning we want. This time, it goes with a specialized meaning of affect: "to have an influence on someone emotionally."
If you're thinking that affect has had a lot of meanings over the years, you're right. Part of the reason is that it actually derives from two sources. One is the Latin verb afficere, meaning "to affect, move, influence, impress," among other things. The other is the so-called frequentative form affectare, meaning "to aim or strive for."
In any case, the verb affect has had so many meanings that just about all the noun forms have been exhausted on rare, obsolete, or specialized meanings. About the only possibilities I see left are affectment and affectance, but the moment seems to have passed for creating these forms.
Meanwhile, there's the noun effect, derived from the Latin verb efficere, which according to my New College Latin & English Dictionary, means "to bring about, bring to pass." Most of the phonetic similarity between afficere and efficere is due to their common origin in the Latin verb facere, meaning "make" or "do."
The rest of the phonetic similarity comes from the nature of the prefixes that combined with facere. While some of those Latin prefixes gave us nice, distinct words like infect, perfect, and defect, others, including ad and ex, changed their final consonant to assimilate to the f of facere. This is why instead of having the different-sounding adfect and exfect, we have the same-sounding affect and effect.
Effect comes from the past participle effectum, which means something that has been brought about, or in other words, a result. The meaning of efficere even comes through clearly in the verb effect, as in effect a change. In other words, the noun effect really does have an associated verb form, but just as with all those noun forms of affect, the associated verb is somewhat rare.
So we have the verb affect "to influence" without a readily available noun form, and the noun effect "result," without a readily available verb form. Add to this mutual need the similar semantics and the nearly identical phonetics, and it's no wonder that the two words have formed a duo.