could the word "attorney" denote both "lawyer" and "prosecutor"?
if so, could you check that I am understanding the following words?

1. attorney=lawyer
2. defense attorney=lawyer
2. district attorney=prosecuting attorney=local prosecutor
It depends on the county, and in the USA, the state. In some states the district attorney is an elected official. He or she is responsible for representing the state. For example the department will assign defense attorneys to clients who cannot afford to pay for one. They will represent the state in criminal cases (prosecuting), and in other legal matters.
You seem to be associatng the word "lawyer" with a particular type of legal practice, which is not the case in the US. Attorney and lawyer are synonymous. You can have a tax attorney, a criminal defense attorney/lawyer, a patent attorney/lawyer, etc. My knowledge of the district attorney is pretty much limited to watching the TV show "Law and Order," so I can't add to what Alphecca has already said.