Attacks of opportunity only happen for a few, specific actions. They’re important, but they are not things that happen all the time. A trained combatant knows how to make attacks without blatantly giving his target an opportunity, and 3.5 adventurers are trained combatants (see the basic weapon proficiencies that even wizards get).
Ranged attacks provoke, if someone threatens you (read: is in melee with you) when you attempt one. Unarmed strikes and various combat maneuvers provoke if you do not have the appropriate “Improved” feat (Improved Unarmed Strike, Improved Grapple, Improved Trip, etc.—note that not every feat with “Improved” in the name removes attacks of opportunity, for example Improved Two-Weapon Fighting does not, in part because two-weapon fighting didn’t provoke in the first place).
Beyond these, attacking does not provoke. Even when attacking with a melee weapon you are not proficient in, or attacking with an improvised melee weapon, does not provoke—only ranged attacks and unarmed strikes.
Some things that do provoke include most forms of movement out of a threatened square (unless you Withdraw or Five-Foot Step), most spellcasting (unless you cast defensively), and rummaging through most bags and containers (but not a handy haversack). For more complete rules, see the Attacks of Opportunity rules, and note how all the entries in the Actions in Combat rules indicate whether or not they provoke, for example:
||Attack of Opportunity?