According to this site the decision was made by Alan Burnett, Bruce Timm, and Brian Azzarello together:
The decision for the two superheroes have casual sex, made by Bruce Timm, Alan Burnett, and screenwriter Brian Azzarello, changes several aspects of both the character’s histories, and twists the film’s overall interpretation of Alan Moore’s infamous comic. Although a sexual or romantic relationship between the two had been teased in some ancillary Batman canon projects (specifically in Batman Beyond), their union is not a mainstay in Gotham stories. Still, director Bruce Timm defended the decision to put in a Wayne-Gordon sex scene.
“It was really important to us to show that both of the characters make some pretty big mistakes. I mean, his ‘parental skills’ aren’t that great,” Timm told Vulture. “Maybe never having had any kids of his own, he doesn’t realize that if you tell a kid to not do something, they’re going to want to do it even more. And then she makes some mistakes and then he kind of overreacts to her mistakes and then she overreacts to his overreaction. So it’s very human; it’s a very understandable story.”
In the interview the site links to Timm says this specifically, although tentatively lays the initial idea at the feet of Brian Azzerello:
I'm guessing there will be a lot of conversation after the movie's release about the sex scene. At what point in the creative process did you come up with that idea?
It came from a three-way conversation between [co-producer] Alan Burnett, [screenwriter] Brian Azzarello, and myself. I don't remember who initially came up with the idea, but we all kind of jumped on it all at the same time and said, Yeah, that's kind of where we need to go. My memory kind of says it was Brian, maybe, who came up with the idea. But I'm not sure.
Of course, it should be noted that Azzarello did not work on the earlier incarnations of animated Batman with Bruce Timm and Alan Burnett, such as Batman Beyond (where both co-developed and produced the series), which included as backstory that Bruce and Barbara once had a relationship, and Batman: Mystery of the Batwoman (written by Burnett) which also had some indications of a relationship, or at least attraction. So although Azzarello might have been the first one to say it at that table, it's also possible that he got the idea from the other two there and their prior work, and merely was the one to voice the idea that they should put it on-screen in this particular movie.