Sonic the Hedgehog (voiced by Ben Schwartz) flees homeworld due to possessing powers that make him a fugitive carrying a bad full of rings that are portals to new dimensions, is typical road-movie adventure comedy we've seen many times in a variety of forms. Sonic ends up teleporting to Earth, specifically the flyspeck town of Green Hills, Montana, where he encounters a sheriff so bored with the town's lack of crims that he's taken to having conversations with his donuts, Tom Wachowski (James Marsden), who is hoping to not make another day a waste by waiting patiently to nail someone speeding. He gets it in Sonic, who clocks in at a speed that makes Tom question his radar gun. Tom dreams of doing some real crime-fighting, with a goal to move him and Maddie (Tika Sumpter), his ever-supportive veterinarian wife, to San Francisco to join their more active police department. It turns out when Sonic loses all of his other rings through an open portal atop the city's Transamerica Pyramid, he'll have to tag along as well.
However, when Sonic's energy burst ends up causing a massive power outage to the entire Pacific Northwest region of the United States, the government sends in a secret weapon, Dr. Robotnik (Jim Carrey), a mad, megalomaniacal genius with an army of sophisticated flying drones who tenaciously will find a way to exterminate the blue alien thing once and for all. Robotnik chases Tom and his new companion Sonic as they make their way to California.