You can either attack or activate the ability.
What happens if the attacker I tap has an ability that is triggered by tapping?
Such an ability would be worded as follows:
Whenever this creature becomes tapped, ...
If a creature had such an ability (e.g. Fallowsage), it would trigger if the creature becomes tapped for any reason, including attacking. In fact, it's effect would only happen if you have some external means of tapping it (e.g. by attacking).
The thing is, very few creatures have such an ability. You're probably not asking about a triggered ability; you're probably asking about an activated ability. Activated abilities have the form "[cost]: [effect]". (Note the ":" and the lack of a leading "when", "whenever" or "at".)
Specifically, I presume are talking about an ability with a tap symbol in its cost. e.g. Golden Hind or Dakra Mystic.
Tapping does not actually initiate the attack or cause activated abilities to activate. Choosing to attack or to activate the ability is the first thing that happens. Tapping is then performed as part of that process.
Tapping as part of activating an ability is done to pay a cost. Tapping as part of attacking is similar. Like costs in real life, taking out a dollar out of your wallet doesn't allow you to buy two one dollar items.