"Ain't It Funny" is a song recorded by American entertainer Jennifer Lopez. 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). "Ain't It Funny" was released as the third single from the album on June 20, 2001, by Epic Records.
While watching a rough cut of The Wedding Planner (2001) in Canada, Jennifer Lopez and Cory Rooney brainstormed ideas for its accompanying soundtrack. The two "pulled different thoughts and feelings" from the film's scenes. The scene where Lopez's character is in the backseat of a car listening to Matthew McConaughey and Bridgette Wilson's characters talk about the wedding made Rooney think of the line "ain't it funny how some feelings you just can't deny and you can't move on even though you try". According to Rooney, "all those words and melodies just started coming" to him while watching the scene. After he conceived the idea for "Ain't It Funny", Rooney returned to his home and "roughed out the track" and came up with the song's chorus. He then worked with Lopez for an hour to complete the song.Tommy Mottola was so enthusiastic about the song that he contributed to its melody.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. Lopez disagreed with Shankman and the two later agreed to use "Love Don't Cost a Thing" in the film.
"Ain't It Funny" is a Latin song, with a duration of four minutes and six seconds (4:06). The song contains a Meccadisco beat and a "bullfight trumpet", as well as a "solid dancefloor thump". Lyrically, Lopez sings about "creating the perfect romance in your mind, then facing reality when Mr. Right is less than ideal".
The song received mixed to positive reviews. 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. He concluded that it still "sort of runs in place, as though Lopez recorded it while standing on a treadmill". Sal Cinquemani of Slant Magazine responded positively to the song, calling it "terribly infectious". He, however, criticized the "overpowering choir of back-up vocalists" that sing the chorus. Jake Barnes of Dot Music called the song bland, writing that Lopez should "check out" Jill Scott's 2000 song "One Is the Magic Number" for how Latin pop "should be done properly".Billboard's Chuck Taylor praised the song's production as "Grade A" and its lyrics as "smart".
"Ain't It Funny" was a commercial success, peaking within the top ten in multiple countries. In Poland, the song peaked at No. 1 for eight weeks on the Polish Singles Chart. In the United Kingdom, the song peaked at No. 3, making it her fifth top-ten single there. "Ain't It Funny" charted at No. 3 in several other countries including the Netherlands, Romania and Sweden. In Sweden, it exceeded sales of 10,000 copies and was certified Gold by the Swedish Recording Industry Association. In Belgium, the song peaked at No. 8 in Flanders and No. 5 in Wallonia. "Ain't It Funny" debuted at No. 25 in Australia on September 2, 2001. Ultimately, it enjoyed a long chart run, peaking at No. 9 on April 28, 2002. "Ain't It Funny" peaked at No. 9 in Norway, and Ireland for the week ending August 9, 2001. The single debuted at No. 14 in Switzerland on July 29, 2001, and peaked at No. 9 three weeks later. It had a successful chart run in Switzerland, remaining on the Swiss Singles Chart for a total of twenty-six weeks. In Spain, "Ain't It Funny" peaked at No. 10 for the week ending July 28, 2001. Additionally, it reached the top twenty in Germany, Austria, Denmark, Hungary and Italy.
From September 22–23, 2001, Lopez performed a set of two concerts in Puerto Rico, entitled Let's Get Loud. These served as the first concerts of her career, in which she was "flanked by a 10-piece orchestra, a five-person choir and 11 dancers." "Ain't It Funny", among other songs, was included on the concerts' set list. In December 2001, Lopez, Kid Rock and Ja Rule headlined a concert for the USO troops in a German military base. Lopez opened her set with "Ain't It Funny". After emerging from a center-stage trapdoor, she performed the song while backed by a line of male dancers "outfitted in military garb". On January 1, 2002, the concert aired as a special on the MTV Network hosted by Carson Daly, For the Troops: An MTV/USO Special. Joe D'Angelo of MTV News noted that she wore "a series of skimpy outfits despite chilly temperatures."
The music video was filmed in sepia tone and directed by Herb Ritts. It opens with Lopez traveling on a road where she finds a fortune-teller who shows Lopez her future with the cards. A group of female gypsies (one of them played by former The Pussycat Dolls member Carmit Bachar) shows up and makes over Lopez so as to make her one of their own. Then Lopez finds a man (played by Mexican soap opera actor Eduardo Verástegui) she could not resist, falling in love with him. In the middle of the video, there is an extended dance sequence, in which she performs a flamenco-influenced routine. Eventually all the people there start dancing together, including Lopez and her lover. The video debuted the week of July 2, 2001 internationally and in the autumn of 2001 in the U.S.