Raymond is based on a megasavant named Kim Peek, who was born in Salt Lake City. Kim suffered from a condition called macrocephaly in which the bundle of nerves linking the two hemispheres of the brain is missing. While he was behind in his physical development -- he didn't walk until he was four years old -- he was ahead in his mental development (https://en.wikipedia.org/wiki/Kim_Peek).
By 16 months of age he was memorizing small books; once read, he would place them on his bookshelf upside down. At age 14, he had already completed his high school education. At age 18, he was hired to do the payroll for 160 people, a task he completed without the use of a calculator. With the invention of computers, his job was phased out ten years later.
Screenwriter Barry Morrow visited Kim Peek in 1984 and interviewed him for a story he had in mind. Morrow tracked down Dustin Hoffman to play the character of Raymond Babbitt, an autistic savant. Tom Cruise was chosen to play his car salesman brother, Charlie. Rainman, which debuted in 1988, was the result.