Grainer was born in Atherton, Queensland, Australia. He attended high school at St. Joseph's Nudgee College on Brisbane's Northside and then went on to study music under Sir Eugene Goosens at the New South Wales Conservatorium of Music, but this was interrupted by World War II. He was enlisted to the Australian Army and was injured, almost losing a leg.
Moving to Britain in the 1950s, Grainer collaborated with the BBC Radiophonic Workshop on a number of television series themes, including Giants of Steam (a documentary about railways) and in 1963 the science fiction series Doctor Who. Grainer was so impressed with Delia Derbyshire's electronic realisation of his score (which remained the standard version of the Doctor Who theme for 18 years) that he is reported to have said on hearing it, "Did I really write that?" - to which Derbyshire responded "well, mostly!" He also offered to split his royalty with her, but this was prevented by BBC bureaucracy. Grainer composed music for several ITC productions, such as The Prisoner.