Obama read aloud a series of "mean tweets" culminating in one from Trump: "President Obama will go down as perhaps the worst president in the history of the United States!"
"At least I will go down as a president," Obama said.
Kimmel joked that Obama had to "take time away from helping rig the election" to appear on the show, a dig at Trump, who has repeatedly said the Nov. 8 vote is rigged against him.
Obama picked up on the joke while describing how comedian Bill Murray beat him in a contest to putt golf balls into a glass in the Oval Office during a recent visit - a stunt the White House designed to promote Obamacare health insurance.
"He won repeatedly," Obama said. "The glass was rigged!"
Kimmel asked Obama, "Do you ever laugh" when watching Trump on television. "Most of the time," Obama said.
Obama also revealed he has been called on a special phone by his bed "three or four times" in the middle of the night during his time in office to deal with emergencies, including when the 2011 tsunami hit Japan.
But he said he does not reach for his smartphone in the wee hours - another dig at the Republican candidate.
"I don't tweet at 3 am about people who insult me," Obama said.
Obama's second and final term ends on Jan. 20. Under the U.S. constitution, presidents are limited to two terms - which is just as well, Obama said.
"If I were able to run for a third term, Michelle would divorce me," he said, noting his wife does not like politics.
Not all the jokes were at Trump's expense. Comedian Will Farrell channeled deceased but beloved Chicago Cubs sportscaster Harry Caray to recommend that Obama "open a shrimp shack" after he leaves office.
And Joel McHale feigned outrage when told he had been bumped from the show for Obama.
"You got the president, huh. Wow, that's a big deal - he's got two months left in the job," McHale said, oozing sarcasm.
"That's a real good get there, Jimmy: Lame! Duck!" McHale said.