A tearful Paine, 36, said he had sent messages to a co-worker at Cricket Tasmania in 2017 that led to a misconduct investigation.
He said he was “exonerated”, but is stepping down as he had learned his texts were set to be revealed publicly.
The first Ashes Test between Australia and England starts on 8 December.
Cricket Australia (CA) said it accepted Paine’s resignation and will appoint a new captain, but that the wicketkeeper-batter will remain in the side to face England.
Fast bowler Pat Cummins, the current vice-captain, is widely expected to take over as captain.
Tasmania’s Paine was appointed captain in 2018 following Steve Smith’s ban over a ball-tampering scandal.
Paine revealed the historical investigation at a press conference on Friday, describing stepping down as “an incredibly difficult decision but the right one for me, my family and cricket”.
He said: “Although exonerated, I deeply regretted this incident at the time and still do today.
“I spoke to my wife and family at the time and am enormously grateful for their forgiveness and support.
“On reflection, my actions in 2017 do not meet the standard of an Australian cricket captain, or the wider community.”
Paine did not disclose the nature of the texts, but CA’s news website called it a “sexting incident involving a former Cricket Tasmania employee in 2017”.
Paine added: “At the time, the exchange was the subject of a thorough CA Integrity Unit investigation, throughout which I fully participated in and openly participated in.
“That investigation and a Cricket Tasmania HR investigation at the same time found that there had been no breach of the Cricket Australia code of conduct.”
CA chairman Richard Freudenstein acknowledged Paine was cleared of any breach but added that the organisation “does not condone this type of language or behaviour”.
After taking over from the banned Smith in March 2018, Paine said Australia must improve their “behaviour” and promised to instil a “new culture”.
The ball-tampering scandal led to a review into Australian cricket, which came out in October 2018 and condemned a “winning without counting the costs” culture, while also saying CA was partly to blame.
Cricket Tasmania said its former employee had not made her allegations against Paine until mid-2018 when she was charged with theft.
Andrew Gaggin, Cricket Tasmania’s chairman, said in a statement that the investigation had found Paine’s “interaction” with the woman to be “consensual, private, occurred on the one occasion only, was between mature adults and was not repeated”.
He added that Cricket Tasmania “clearly does not condone this type of behaviour” but determined that “no further action was required or appropriate” because of the “consensual” nature of the texts.
He added that criminal charges against the former employee were still pending and could not comment further.
Paine, who has scored nine 50s in 35 Tests, had neck surgery in September, but has previously said he is confident he will be fit for the Ashes.
Smith was banned for a year by CA in 2018 for his part in the ball-tampering scandal- during the third Test against South Africa in March that year, and for attempting to cover up the fact that Cameron Bancroft had used sandpaper on the ball.
The batter was also banned from captaining Australia for at least two years at the time.
In March 2020, Paine said he would “fully support” Smith if he were to return to the captaincy.
Under Paine’s captaincy, Australia retained the Ashes in 2019 with a 2-2 draw, becoming the first Australia side to do so in England since 2001.
However, they were also beaten at home by India in both 2018-19 and earlier this year, with the latter series featuring Australia’s first Test defeat at the Gabba in Brisbane since 1988.
Paine also apologised for his behaviour in the drawn third Test against India in Sydney in January, after sledging Ravichandran Ashwin and being fined 15% of his match fee for showing dissent and swearing at umpire Paul Wilson.
The 2021-22 Ashes begins in Brisbane, before matches in Adelaide, Melbourne, Sydney and Perth. (Courtesy BBC)