Actually Paul Anka only wrote the words.
It’s set to the music of the French song “Comme d’habitude” co-composed, co-written and performed in 1967 by Claude François.
Another interesting tidbit:
In 1968, then-unknown singer/songwriter David Bowie was asked by his music publisher to write English lyrics for the original French song. As Bowie relates on his VH1 Storytellers live album, his version, Even a Fool Learns to Love, was “rejected out of hand, quite rightly, I feel,” and was never recorded. Later, he reworked the chords of the French song and turned it into Life on Mars?, a track on his 1971 album Hunky Dory, and included the note “inspired by Frankie” (referring to My Way singer Frank Sinatra) in the liner notes.
Bowie may have been inspired by Comme dhabitude, but his Life on Mars song bears very little relation to the model.