It was written by Lopez and Cory Rooney for the Adam Shankman-directed romantic comedy The Wedding Planner (2001).
Shankman, however, felt that the song had too much of a Latin-influence to be featured in the film, and it was instead included on Lopez's second studio album, J.Lo (2001).
[5] While watching a rough cut of The Wedding Planner (2001) in Canada, Jennifer Lopez and Cory Rooney brainstormed ideas for its accompanying soundtrack.
[6] After he conceived the idea for "Ain't It Funny", Rooney returned to his home and "roughed out the track" and composed the song's chorus.
[7] Adam Shankman, however, felt that "Ain't It Funny" had too much of a Latin influence for the film, due to its usage of timbales.
Josh Freedom du Lac of Wall of Sound wrote that "Ain't It Funny" steals its melody "wholesale" from Madonna's "La Isla Bonita", although it has a better rhythmic base.
[10] Sal Cinquemani of Slant Magazine responded positively to the song, calling it "terribly infectious".
[5] "Ain't It Funny" was a commercial success, peaking within the top ten in multiple countries.
[14][15] In Sweden, it exceeded sales of 10,000 copies and was certified Gold by the Swedish Recording Industry Association.
[23][24][25] In December 2001, Lopez, Kid Rock and Ja Rule headlined a concert for the USO troops in a German military base.
After emerging from a center-stage trapdoor, she performed the song while backed by a line of male dancers "outfitted in military garb".
[27] Joe D'Angelo of MTV News noted that she wore "a series of skimpy outfits despite chilly temperatures.
Then Lopez finds a man (played by Mexican soap opera actor Eduardo Verástegui) she could not resist, falling in love with him.