Twitter shares closed up nearly 4 percent Tuesday after Cuban's comment.
In an interview on "Squawk Alley," the "Shark Tank" judge said he's been buying into companies that work in AI, deep learning and machine learning.
"I started buying Twitter recently because I think they finally got their act together with artificial intelligence," he said at BTIG's 15th annual charity day in New York.
The remarks by Cuban came six days after Twitter reported better-than-expected first-quarter earnings.
The social media company has used algorithms to combat user harassment, vowing to prevent abusive behavior and block repeat offenders from the site. They've also used machine learning to tailor ads and tweets to users.
Twitter said in its first-quarter earnings release, it "continued to use other machine learning techniques to improve the relevance of notifications, which increased engagement and brought people back to Twitter."
"I don't know. I think so, I hope so. But if they (government) are not we are certainly going to help because it is a technology that is important, it is a trend that we need to see more of and it does help people," Dorsey told CNBC.
Ali Mogharabi, an analyst at Morningstar, told CNBC on Tuesday that Twitter has started to hire the right people and is getting smarter about harnessing its data for machine learning.
"We do agree with (Cuban)," Mogharabi said on "Power Lunch." "They analyze the user interaction, the user engagement over what topics, what time during the day. The machine learning technology comes up with the best ad to present in front of you."
In addition, Twitter will use data to tailor content to users.
"They're doing that to make sure they keep the users on the Twitter platform as long as possible, again to attract the advertising dollars," he said.
— CNBC's Arjun Kharpal contributed to this report.
Disclosure: CNBC owns the exclusive off-network cable rights to "Shark Tank," which features Mark Cuban as a judge.