But it would be too simple to suggest that his solitary artistic ambition was to sneak into classical music. He chose his instrumentation, he said, to emulate the sound of the organ he had grown up hearing in church. And he argued for the importance of establishing an American concert canon, spanning African-American work songs, spirituals, the blues and Broadway tunes.

The young pianist Kris Bowers composed the score to “Green Book” and rerecorded Shirley’s arrangements for the soundtrack. Unsurprisingly, he had never heard Shirley’s music before, but speaking about it now, he borders on reverence. “‘Lullaby of Birdland’ was one of the first ones that I knew I wanted to include, because he starts off quoting a couple of classical pieces, and then when he goes into the song, it’s almost like a false start, because he uses the melody as the beginning of a fugue,” Bowers said in an interview. “He’s doing a proper fugue, exposing the subject, et cetera, within a jazz context. I listened to that and said, ‘Wow, I’ve never heard anybody do that before.’”

By the early 1960s, Shirley was recording regularly for Cadence Records and was represented by Columbia Artists management (whose roster included Igor Stravinsky, Paul Robeson and Aaron Copland). This helped him become a fixture of New York cabarets like the Cookery, though he despised playing in clubs, where he rarely felt the audiences respected his music enough. Columbia also booked the tour depicted in “Green Book.”

Six years earlier, Nat King Cole had been brutally assaulted onstage in Birmingham, Ala., and swore he would never return to the segregated South. The region remained dangerous for black travelers into the 1960s (the movie title refers to a guide, similar to one that AAA might have issued, to help them find safe passage), but Shirley undertook his tour of whites-only theaters and parlor venues out of civic obligation — and stubbornness. He refused to be told, yet again, what he could play where.

In “Green Book,” the tour begins at Shirley’s resplendent apartment in the artists’ units above Carnegie Hall, where he lived for more than 50 years. You can imagine that he enjoyed the real estate but also felt trapped in a kind of bell tower, overhearing the symphonies that he would rather have been performing. Yet Shirley did have illustrious moments on Carnegie’s stage. He played concerts with his trio there once a year. And he held the piano chair during the Carnegie Hall debut of Duke Ellington’s “New World a-Comin’,” in 1955, playing big, flourishing chords during his cadenzas and strutting proudly in the left hand under the combined jazz ensemble and symphony orchestra.