Q (standing for Quartermaster), like M, is a job title rather than a name. Q is the head of Q Branch, the fictional research and development division of the British Secret Service MI6. In the film series, there have been at least 3 different characters behind the title of Q. The pre-John Cleese Q, most identified with actor Desmond Llewelyn, John Cleese's R cum Q, and the new era Q portrayed by Ben Whishaw.
Q also makes his literary debut in Dr. No, Ian Fleming's sixth Bond novel, introducing him in the same scene which occurred in the film adaptation itself, the switch from the Berreta to Walther PPK scene.
In Spectre, Q injects Bond with "smart blood" which will allow MI6 to track him at all times. He then shows off an Aston Martin DB10 to Bond only to disappoint him by revealing it was reassigned to 009. He provides Bond with a new watch, while hinting the alarm is "rather loud" (eventually revealed to be explosive in the film's climax). He also oversees the restoration of Bond's Aston Martin DB5 after the events of Skyfall. Bond requests Q help him disappear during his downtime: despite initial reluctance, Q agrees and helps Bond. Bond later steals (and ultimately destroys) the DB10, much to Q's dismay, although he still covers for him when M asks Q where Bond has gone. Similar to Q's assistance to Bond in 1989's Licence to Kill, Q travels to Austria to help him in the field independent of MI6. While there, he outruns SPECTRE agents after a ring he eventually decodes, revealing the organisation's existence. Q returns to London to assist Miss Moneypenny and M in foiling corrupt MI6 bureaucrat Max Denbeigh's launch of the Nine Eyes intelligence network. At the end he provides Bond with his remodelled Aston Martin DB5.
In No Time To Die, it is hinted that Q is gay when Bond and Moneypenny interrupt his preparing a romantic dinner for another man. He provides Bond and 00 agent Nomi with a watch that generates an electromagnetic pulse and a portable radar mapping device, and instructs them on how to operate the "stealthy bird", a small submersible jet aircraft before they infiltrate Safin's base. Q keeps in contact with Bond during the mission, and patches him through to Madeleine after he decides to sacrifice himself. Q later joins M, Tanner, Moneypenny and Nomi in a toast to Bond's memory at the end of the film.