The often-quoted sung line: "I am so smart! I am so smart! S-M-R-T! I mean, S-M-A-R-T!" This was an actual mistake by voice actor Dan Castellaneta, but it was just so "Homer" they left it in.
Homer's famous "D'oh!" was improvised by Castellaneta. The script only said "annoyed grunt". (And still does.)
As was Homer's song "Dancing Away My Hunger Pangs" on the season 12 episode "Hungry, Hungry Homer" (where Homer goes on a hunger strike to save the town's baseball team).
Recurring guest star Albert Brooks is known for doing this. Noticeable when he plays Hank Scorpio in "You Move Only Twice' - most of his fast, random declarations are improvised. The entire Hammock district routine is improvised - hence why Homer only replies with a quick "Yes" because Dan Castellaneta had trouble keeping up with Brooks. Only at the end does he catch up and reply "Oh, in the hammock district".
David also coughed while recording one of Megatron's power-hungry laughters, but they decided to leave it in, with the animators adding a surprised reaction shot of Inferno to complete the effect.
Futurama: An In-Universe example is where Calculon is showing the clip to a new episode of his show where he does a Big "NO!". He informs the talk show host he was actually supposed to say "yes" but kept it in.
For an out-of-universe(?) example comes Fry's "No, I'm doesn't" from "The Route of All Evil" in response to being told that alcohol makes one stupid. The line was intended to be "No, it doesn't", but Billy West's flub was so hilarious and fitting they kept it.
The first episode contains the line 'Invader's blood marches through my veins - like giant, radioactive rubber pants! The pants command me! DO NOT IGNORE MY VEINS!" The line was supposed to say 'ants'. But it's the kind of show where "pants" actually fits better.
The Hamstergeddon episode involved Ultra Peepi swaggering down the street, not by intention. It came back from animation that way, and Jhonen loved it and had the composer make funk music to go under it. "I want to hear Barry White saying 'Ultra Peepi.'" Check it out here.
In Batman: The Animated Series, The Joker's squee after explaining his plan to Batman in the episode Joker's Wild wasn't in the script. Mark Hamill just sort of did it after reading his line, and the cast and crew were laughing so hard that they apparently took the rest of the day off. The next day, they went ahead and added an extra second of animation to include it.
Motor Ed was created because John DiMaggio was goofing around in the break room and made up the voice for a laugh.
Freakazoid!'s voice actor was supposed to refuse a plot hook with a "No," and the sequence ended up twenty seconds longer because of what he did say.
Jeepers: Hehehehehe... You want to see something strange and mystical? Freakazoid: NO! Get out of here with that watch! Lay off the poor beavers, will ya?! SHEEEEESH! You're a creep! Go away! We were having a good time until you showed up, Jeepers! Urrrg! Go have some coffee with cream or something! Because I'll tell you something... This is a happy place!
According to the audio commentaries, this happened a lot. Even the casting of writer Paul Rugg as Freakazoid was an accident; he was just supposed to be the placeholder, but ended up being so funny (in part because of his wild improv), that he was cast permanently. Apparently, several large sections of the first episode were entirely made up on the spot by Rugg.
Looney Tunes. Bob Clampett's 1943 short An Itch in Time has a scene of a dog, having been irritated by a flea, scooting wildly around a carpet on its rear end. As an "inside" joke, Clampett and his animators added an off-color gag of the dog pausing to tell the audience, "Hey, I'd better cut this out, I may get to like it!", fully expecting that either the studio or the Hays Office would have it removed. Astonishingly, they didn't.
(Porky sends his dog after a duck, but instead of letting himself get caught, the duck picks up the dog and dumps him on the shore of the pond)
Porky: Hey! Th-th-that wasn't in the script!
Daffy: Don't let it worry ya, skipper, I'm just a crazy darn fool duck. (bounces away across the pond, laughing maniacally)
The Woody Woodpecker short Wet Blanket Policy originally didn't have "The Woody Woodpecker Song" in it, but it was added in at the last minute by Walter Lantz, when he discovered how much of a surprise hit the single had become.
Sokka was originally intended as a more sullen character. However, his voice actor was a Jim Carrey-inspired comedian, so Sokka gradually turned into a much more over-the-top comic relief. The creators noted that because of this change, Toph ended up filling Sokka's original role.
Also, the famous Foamy Mouth Guy was just going to faint in the background. Then an animator got really creative...
Not to mention that the show's staple Mix-and-Match Critters were also the result of a particularly bored animator.
Sequel SeriesThe Legend of Korra has a scene in "The Spirit of Competition" where Mako is angrily walking through a door and completely ignores a fan trying to say hi ("Hey Makooooo-oh"). This originated when someone drew a random extra standing next to Mako in the animatic and the episodes director thought he looked disappointed.
There was an In-Universe case in a mover where Bolin kisses an actress in a scene where he wasn't supposed to and the director decided to keep the kiss.
In the Code Lyoko episode "Tidal Wave", Odd's final line, "I'm so hungryyyyy!", was ad-libbed by his dub actor.
In the Daniel and the Lions' Den segment of the first VeggieTales, a render glitch made a sudden flash of light in the background during a scene. The animators weren't able to fix it, so they just added a thunder sound effect and made an instant storm, that actually darkens the mood in the right way.
In the first episode, a pony in the background was given crossed eyes as a joke by an animator, and wasn't intended to be visible. Last minute changes moved a bunch of other characters out of the way, making this pony visible. Fans noticed, and were amused, leading to the pony being nicknamed "Derpy Hooves." The joke became so famous that the show's creator, Lauren Faust, said "she can be Derpy if everyone likes." They also gave her the cross-eyed look in most other episodes she appeared in during season 1, and from season 2 on her appearances are fully scripted. She has since gone on to become one of the most beloved characters in the series and something of a mascot for the fanbase, with the largest MLP image booru on the net being named after her.
A rather unhumourous example happened in The Ren & Stimpy Show Adult Party Cartoon spinoff that ultimately led to cancellation of the series. The episode "Onward and Upward" contained a graphic homosexual sex scene between the eponymous duo in the original run, added as a joke by an animator. Creator John Kricfalusi explained that there was never supposed to be any actual sex in it, that Ren and Stimpy were supposed to be playing baseball under the sheets (as a part of a vague "pitcher and catcher" metaphor earlier in the episode). He claimed he wanted to cut it straight away, but he felt sorry for the animator who thought it was funny. The scene was left in and caused a minor uproar at an animation newsgroup, where a group of people thought Kricfalusi was trying to sabotage his own show - the executives at Spike TV saw this conversation, thought that's the way everyone felt and cancelled the project. Go figure.
For an actual humorous example, the animation error in Stimpy's eyes (he looks like Barney Rubble for a split second◊) in "Stimpy's Breakfast Tips" was so hilarious that John left in in.
When building the models for the TV series Tugs, it was found that Zorran's eye mechanism caused the front of his hat to tip up. They left it in because they thought it added to the expressiveness of the character.
In the episode Munitions, a piece of debris from one of the explosions hits Warrior, bouncing off of him. A piece of dialogue was later added with him exclaiming "That bit hit me!"
According to Ashley Eckstein, she was asked to use an Icelandic accent for the voice of Ahsoka Tano in Star Wars: The Clone Wars, but when she came in with a practiced Icelandic accent, it apparently wasn't what they expected. The voice she ended up getting told to do in the show is based on the tones in her real voice during the audition when she got frustrated that she couldn't figure out what accent they wanted.
In The Brak Show, Dad was originally intended to be around the same height of the rest of the main cast. A mistake in scale was made while compositing a scene, and the new, comically small version of the character was deemed funny enough that they stuck with that design.
Home Movies is so improvised, you can hear the actors stuttering and trying to come up with a new line. The show's creators have noted that some fans were upset to find that the show was even loosely scripted—having plot points outlined, but leaving most dialogue to the actors.
Nick Bakay and Richard Steven Horvitz, respectively the voice actors for Norbert and Daggett on The Angry Beavers, improvised a lot of their dialogue as well.
In the first episode of The Flintstones the script originally called for Fred to yell "Yahoo!" but Alan Reed thought that was too bland and asked if he could come up with something better. This is how he came up with the Catch Phrase "Yabba-dabba-doo!"
While Phineas and Ferb contains very few ad libs, one notable one appears during the song "Only Trying to Help" from the episode "Phineas and Ferb: Mission Marvel". The end of the song, where Isabella and Candace repeat a line of the chorus, was originally improvised by Isabella's voice actress, Alyson Stoner.
In the episode "Rixty Minutes" of Rick and Morty, Rick and Morty are watching interdimensional TV. A trailer for a movie called "Two Brothers" plays, and the trailer's narrator (Justin Roiland, who also voices Rick and Morty) starts laughing at the end over how goofy the idea is and they decided to leave it in. In the same episode, during an episode of "Raising Gazorpazorpfield", a fictional parody of Garfield, Gazorpazorpfield (also voiced by Roiland) is insulting John, and Roiland again laughs while saying the word "enchalatas".