This thread is inspired by the “Movies That Would Have Been Better With No Love Interests” thread.
I read somewhere that Glen Campbell was hideously miscast as La Boeuf in the original (1969) “True Grit” because the producers wanted a “hit song” on the soundtrack. Campbell sings the title song “True Grit”; I know this from looking it up on IMDb, because I can’t remember a note of it. (Fun fact: they offered the role to Bob Dylan for the same reason.)
But dishonorable mention goes to B.J. Thomas’s “Raindrops Keep Falling On My Head” from “Butch Cassidy and the Sundance Kid” (also 1969). I haven’t re-watched the film, but I remember it as an entertaining but peculiar mix of “jaunty” comedy and grim violence.
I gather that George Roy Hill et al were attempting to produce an appealing gripping Western desperado “action” story with “light-hearted” elements. Casting two charismatic stars was a good start, perhaps, but the insipid Burt Bacharach song feels tacked on at best. Robert Redford reportedly hated it, and I’m with Redford.
Maybe not what the OP had in mind but you watch “Fast Times at Ridgemont High” and there’s soi much good music. But then there’s “Raised on the Radio” by “The Ravyns” and you think, “How’d that get in there?”
The song is only off by a couple years though (the movie is set in 1965, the song came out in 1967), and isn’t anachronistic in style, like Raindrops in Butch and Sundance.
The Austin Powers “Goldmember” movie opens with Britney Spears singing the song “Boys” for no particular reason. The song didn’t even make the Hot 100, peaking at 22 on the “Bubbling Under” chart.
“All For The Love of Sunshine” by Hank Williams Jr. from “Kelly’s Heroes”. Matches the action so well doesn’t it? I’m reading a book about the history of MGM, and MGM Records’ chief Mike Curb stuck this song into the movie without notifying the director.