According to JMS, the name came from the influence of ancient Babylon on the show's plot. It's likely he had the name in mind before writing that Captain Power episode.
Evidence for the ancient Babylon influence comes from DVDs, which I unfortunately don't have access to at the moment. I've cited my secondary sources.
In the DVD commentary for the episode "Chrysalis", Straczynski says:
"I picked Babylon for the station, because a lot of what happens in the Babylon 5 story comes out of Babylonian creation myth, which says that the universe was born out of the conflict between order and chaos."
(Quote found on The Bablyon Project wiki's "Babylon 5 Influences" page)
In the DVD extras of Babylon 5: The Lost Tales, he explains further in a segment titled "Why Babylon 5?":
"If you look back at history, the ancient Babylon was a point of intersection for a lot of different cultures. It was a point of trade, it was a place where a lot of business got done. Also very corrupt, also very political. So on the one hand that represented Babylon 5. In addition to that we had the Babylonian creation myth which stipulated that the universe was created through the intercession or the balance between order and chaos. And that of course was the very nature of the Vorlon, Shadow conflict. And those who really wanted to get a peek ahead at what the conflict was could easily have gone back to early Babylonian creation myth, and what we did on B5 very closely parallels to Babylonian creation myth."
(Quote found on a Reddit thread asking a similar question, backed up by a description from a contemporary article about the DVDs.)
Of course, these just explain the "Babylon", not the "5". The fact that previous Babylon stations had gone wrong was a plot point but I couldn't find anything saying why he chose four previous stations as opposed to three or five or a hundred.
As for the when, that's less clear but we can make some educated guesses. Straczynski says in SyFy Wire's oral history of the show that he wrote the pilot and show bible "around 1989". However, he also says it took five years to sell the concept. Given that the pilot was greenlit in 1991, this suggests he might've been working on the idea as early as 1986.
This timeline (found by @Michael in the comments) backs up that earlier date, stating that the initial ideas were written in 1986 and the bible and pilot drafts were completed by mid-1987.
It's hard to be sure without knowing the production schedule of Captain Power but the most likely explanation seems to be that Straczynski already had the name "Babylon 5" planned for the show by the time he wrote "Final Stand" and simply snuck it in as an Easter egg.
If it had been the other way around - he came up with the name for "Final Stand" and later attached it to his show idea - I would've expected him to mention it in the above interviews when asked about the name.