Defense lawyer, Adel Ramadan, said the judge found the men guilty of the "habitual practice of debauchery" - a term used in the Egyptian legal system to denote consensual homosexual acts.
The convictions were confirmed by a judicial official, who spoke on condition of anonymity because he was not authorized to talk to journalists.
Homosexuality is not explicitly referred to in Egypt's legal code, but a wide range of laws covering obscenity, prostitution and debauchery are applied to homosexuals in this conservative country.
The five men were arrested in what human rights groups describe as a crackdown on people with the AIDS virus, using the debauchery charges as a means to prosecute them.
Four of the five men tested HIV-positive after all were forced to undergo blood tests in custody, Human Rights Watch says. The New York-based rights group issued a statement Tuesday signed by more than 100 other organizations around the world condemning the prosecutions.
Ramadan, a lawyer with the Egyptian Initiative for Personal Rights, said the five men were abused and tortured over the past several months to "extract confessions" from them.
Along with three years in prison, the men were sentenced to an additional three years of police supervision.
Ramadan said the defendants were shocked by their convictions.
"Two of them cried, screamed and shrieked," Ramadan said. He said the others "remained silent, but I saw anger in their eyes for the injustice they have been exposed to."
Ramadan said he appealed the verdict to Egypt's Court of Cassation, the country's highest appellate court.
Dozens of human rights groups have criticized this trial and other similar ones as being driven by ignorance and fear of AIDS. They have warned that the convictions could undermine AIDS prevention in Egypt.
The five convicted Wednesday were among 12 people arrested in a sweep that began in October, when police arrested a man during an altercation with another man on a Cairo street, Human Rights Watch said.
After one of the men said he was HIV-positive, authorities opened investigations into other men whose names or contact information were uncovered in interrogations of the first group of men, Human Rights Watch said.
Egyptian police have denied making any arrests because of a person's HIV condition.
In mid-January, four other HIV-positive men from the group of 12 were sentenced to one-year prison terms on similar charges of debauchery. Three others from the 12 were not prosecuted, Human Rights Watch said.