It was in Glasgow in 1957, as part of the city's fight against tuberculosis. It's worth noting that the X-Ray machines weren't actually on the tram. It was simply used to advertise the campaign.
- [Image source Wellcome Collection CC BY]
Mobile X-Ray units were used in the UK (the Mass Miniature Radiography (MMR) programme), but in vans, rather than trams. Similar mobile units were actually brought back into use in London in 2005 to tackle a rise in TB cases in some areas of the city.
This page from the People's History of the NHSPeople's History of the NHS explains about the 1957 advertising campaign in Glasgow in a little more detail:
Despite reduced incidence of tuberculosis in England and Wales, Scotland, and in particular Glasgow, had been dogged by tuberculosis throughout the immediate postwar period. By the 1950s the Department of Health for Scotland was committed to reducing the incidence of the disease by creating an X-Ray campaign accompanied by a media 'blitz'. As part of Glasgow's X-Ray campaign against tuberculosis, 11 March to 12 April 1957, Glasgow Corporation produced this large advertisement to be displayed on the side of a tram car in the city.