It has been argued that one of the first CCTV systems was created in 1926 by Russian scientist Leon Theremin (the creator of the theremin — a musical instrument famously used for the film The Day The Earth Stood Still) to monitor visitors to the Kremlin.
The first widely acknowledged video surveillance system was set up in Germany in 1942 to monitor the launch of V2 rockets from a safe distance, followed by American scientists using it for the same purpose during atomic bomb tests. However, these early systems were for observation only, they did not record images.
CCTV became commercially available in 1949 (perhaps not coincidentally the same year George Orwell's Nineteen Eighty-Four was published) and was quickly taken up for use as a security measure — still requiring observation rather than recording.
Video recording capability arrived for television in the early 1950s but wasn't used much for CCTV due to the limitations of early recording methods — reel-to-reel recording of magnetic tape required large, complicated equipment, technical knowledge to operate, and took a lot of time to set up. (You can see Britain's very first video tape recorder being demonstrated in 1958 here: https://www.bbc.com/historyofthebbc/anniversaries/april/vera-video-recorder.) Due to these limitations, it was mostly governments and larger businesses that utilized CCTV; a notable early example was in 1953 during the coronation of Queen Elizabeth II.
During the 1960s, CCTV systems began to be set up by law enforcement and government throughout the UK, Europe and the USA. In addition to traffic management, the Metropolitan Police used the technology to monitor events attended by the Prime Minister or the Royal Family, and deployed CCTV on transport throughout London (including the Underground).
The availability and affordability of VCRs during the 1970s made it easier to record onto tapes for surveillance (over and over and over again — until they wore out) to rewatch back, and as a consequence CCTV grew in prevalence. Individuals and smaller business —including shops and banks — could install a CCTV system to keep an eye on their premises — and the cameras were obvious enough to make potential thieves think twice. At this point, the images were usually still in black and white, as the resolution was superior to that of colour cameras.
CCTV began to be used for monitoring public spaces throughout the 1980s, such as in parks, shopping centres and car parks. West Norfolk County Council states that their implementation of CCTV in King's Lynn in 1987 was the first public use of video surveillance in the UK.