Yes, it was brought up in 1x18, A Voice in the Wilderness, Part 1, and hinted at in the voice-overs for Season 1 and Season 2 (bolding mine):
Season 1 voiceover:
Jeffrey Sinclair: It was the dawn of the third age of mankind, ten years after the Earth/Minbari war. The Babylon Project was a dream given form. Its goal: to prevent another war by creating a place where humans and aliens could work out their differences peacefully. It's a port of call, home away from home for diplomats, hustlers, entrepreneurs, and wanderers. Humans and aliens wrapped in two million, five hundred thousand tons of spinning metal, all alone in the night. It can be a dangerous place, but it's our last best hope for peace. This is the story of the last of the Babylon stations. The year is 2258. The name of the place is Babylon 5.
Season 2 voiceover:
John Sheridan: The Babylon Project was our last, best hope for peace. A self-contained world five miles long, located in neutral territory. A place of commerce and diplomacy for a quarter of a million humans and aliens. A shining beacon in space, all alone in the night. It was the dawn of the Third Age of Mankind… the year the Great War came upon us all. This is the story of the last of the Babylon stations. The year is 2259. The name of the place is Babylon 5.
A Voice in the Wilderness:
Susan Ivanova: We were told that the planet we're orbiting is stable, safe, and uninhabited. Now it appears to be none of those things.
Being in neutral territory and unaligned with any of the major powers (besides the Earth Alliance running it) makes it the perfect place for diplomatic negotiations to take place, since any wars should not involve the station.
Since I guess this question included, "Why not build the station in empty space?", here's a pretty good reason:
See those 12 blue "wings", 6 on each side?
Those are solar panels. Babylon 5 gets a large chunk of its energy from the star that Epsilon III orbits, so it has to be close enough to the star to get a reasonable amount of energy.
EDIT 2: It looks like these were originally designed as solar panels, but prior to the show being created, JMS changed them to "heat dissipators", which I presume are similar to heat sinks. Heat sinks only work when there's something to transfer the heat to - such as a planet's atmosphere. However, this would require B5 to be partially in the atmosphere of Epsilon III, which we can be fairly sure it isn't - since most ships are not built for it, including most starfuries.
EDIT 3 (2017-10-16) - A piece of dialogue from the pilot movie, The Gathering: "(something something) for ambient heat energy from the solar collectors.", around 1:15 when they're scanning for the Changeling Net. The onscreen visual also says "Filtering Collector Heat", but does not highlight any part of the station.
Below was written on the belief that those are solar panels(Which, IMO, still makes most sense as those "heat dissipators" aren't even near the fusion reactor seen at the end of 3x02)
Orbiting the star at that close range means it has to do one of the following:
- Dodge planets, wasting energy/resources with usage of engines that were never built into Babylon 5 (all it has are thrusters that help it keep orbit).
- Achieve a perfect orbit that doesn't intersect with anything else orbiting the star. Since it doesn't have a planet's gravity well as protection, there's bound to be additional debris, like meteors, it has to deal with.
- Orbit a planet, using it as a shield from debris, and following its orbit around the star (since we can be quite certain it won't intersect another planet).
Babylon 4, on the other hand, appears to have been of a rather different design:
The solar panels all point in one direction. It was the largest and most expensive of the stations. And there doesn't appear to be a planet where it was.
It looks likely that Babylon 4 probably was meant to sit outside the orbit of any planet, and adjust its positioning as necessary. It also wasn't officially online yet, so it may not have been moved into optimal position, either.
But when it disappeared and work on Babylon 5 was started, it ended up the smallest and cheapest of all the stations, and probably had to be more efficient in its power usage - so, for reasons above, orbiting a planet was likely the best choice.