Joe Gardner, a middle school music teacher from New York City, dreams of playing jazz, even though his mother Libba insists he makes his current job full time, fearing for his financial security. One day, Joe learns of an opening in the band of jazz legend Dorothea Williams and auditions at a music club. Impressed with Joe's piano playing, Dorothea agrees for him to perform later that night. As Joe heads off, his excitement distracts him, and he falls down a manhole.
Joe finds himself as a soul heading into the "Great Beyond". Unwilling to die, he tries to escape but ends up in the "Great Before", where counselors—all named Jerry—prepare unborn souls for life with the help of mentor souls. Each soul has a badge in which, once filled out with traits, grants passage to Earth. Mistaken for a mentor, Joe is assigned to train 22, a cynical soul who has always lived in the Great Before and desires avoiding Earth. Discovering that Joe is in a coma at a hospital, 22 agrees for Joe to find her "spark" to complete her badge and then take it so that he can return home. After Joe fails to find 22 a passion, they head for "the zone", where souls enter when their passions create a euphoric trance, and where obsessed lost souls arrive. They come across Moonwind, the captain of a galleon bearing a troupe of hippie mystics, and they help Joe by having him sense his body until he discovers his surroundings.
Joe hops back to Earth but accidentally carries 22, resulting in 22 entering his body and Joe entering Mr. Mittens, a therapy cat. They find Moonwind (at his day-job as a sign twirler), who agrees to meet them later at the music club to restore Joe to his body. In the meantime, 22 settles into Joe's body and enjoys small moments while interacting with Joe's peers. She holds poignant conversations with Connie, a student who planned to quit the band but changes her mind after performing a trombone solo; Dez, who wanted to become a veterinarian but now enjoys being a barber; and Libba, who accepts Joe's passion for music. Meanwhile, Terry, an obsessive accountant who counts souls headed to the Great Beyond, discovers that Joe is missing, and heads to Earth in order to send him to the Great Beyond and restore the count.
As the day ends, Joe and 22 rendezvous with Moonwind, but after Joe tells 22 that her experiences were not purposes, 22 flees with Joe tailing behind to find her spark. Terry notices them running into a subway station, and brings both back to the Great Before. 22 realizes her badge is filled out, yet Joe insists it was because of his traits, and that she didn't actually get her spark. 22 angrily tosses the badge at him and disappears into the zone. A Jerry informs Joe that instead of a purpose, a spark means that a soul is ready to live, but he refuses to believe this and uses the badge to return to Earth.