Trainor wrote “Bad for Me” with Ajay Bhattacharyya and Stephen Wrabel, strangers to her at the time, about a personal situation she experienced. She stated: “Toxic relationships can be in your family and you can step away from them and it sucks. But it’s doable.” That night, Daryl Sabara suggested that the song is the right one for Trainor to record as a duet with Swims, who she had wished to collaborate with for a long time. Swims, friends with Bhattacharyya and Wrabel, responded to the proposition: “I would be honored to be part of this”, and they recorded it in Trainor’s home studio the following week.