In canon, Yes:
In TOS, "Where No Man Has Gone Before":
In the TOS episode "Where No Man Has Gone Before", the Enterprise is on a mission to probe beyond the galaxy. They are not flung outside of the galaxy against their will due to alien intervention, or any other reason. They leave the galaxy, or at least attempt to, because they intend to do so. Kirk gives the reason that "other vessels will be heading out here someday and they'll have to know what they'll be facing."
From a transcript of the episode, original Airdate: September 22, 1966, the opening Captain's log [in all the following quotes the emphasis is mine]:
Captain's log, Star date 1312.4. The impossible has happened. From
directly ahead, we're picking up a recorded distress signal, the call
letters of a vessel which has been missing for over two centuries. Did
another Earth ship once probe out of the galaxy as we intend to
do? What happened to it out there? Is this some warning they've left
It was planned:
KIRK: We hope to learn from the recorder what the Valiant was doing here and what destroyed the vessel. We'll move out into our probe as soon as we have those answers. All decks, stand by.
MITCHELL: Department heads, sir. You wanted everybody on the Bridge before we left the galaxy. Jones.
SMITH: The name's Smith, sir.
SULU: Astro sciences standing by, Captain.
SCOTT: Engineering division ready, as always.
PIPER: Life sciences ready, sir. This is Doctor Dehner, who joined the ship at the Aldebaran colony.
Kirk orders the enterprise to leave the galaxy at warp factor 1.
When the Enterprise attempts to "probe outside the galaxy", they encounter a "Force field of some kind":
KIRK: That's probably the best argument to continue the probe. Other vessels will be heading out here someday and they'll have to know what they'll be facing. We're leaving the galaxy, Mister Mitchell. Ahead, warp factor one.
SPOCK: Force field of some kind.
MITCHELL: We're coming up on it fast.
SPOCK: Sensor beam on.
KELSO: Sensor beam on, sir.
SPOCK: Deflectors full intensity.
KELSO: Deflectors full intensity.
SPOCK: Deflectors say there's something there, sensors say there isn't. Density negative. Radiation negative. Energy negative.
KELSO: Whatever it is, contact in twelve seconds.
KIRK: Gravitation on automatic. (consoles blow up) Emergency stations. All decks on fire alert. Neutralise controls. Kelso, put it on manual. Any radiation? Anything?
KIRK: Helmsmen, take us out of here. (Dehner gets hit by an electric charge, then Mitchell) Helmsmen! (Kirk takes controls) Lateral power! (Spock takes over, Enterprise veers away) Take damage reports.
It is also referred to as a "barrier":
Captain's log, Star date 1312.9. Ship's condition, heading back on impulse power only. Main engines burned out. The ship's space warp ability gone. Earth bases which were only days away are now years in the distance. Our overriding question now is what destroyed the Valiant? They lived through the barrier, just as we have. What happened to them after that?
The Enterprise approaching the barrier:
The Enterprise departing the barrier:
(Yes, approaching and departing are different colors in the original.)
Was it ordered by Starfleet?
There is nothing in canon that explicitly states that the "probe out of the galaxy" was ordered by anyone higher in Starfleet than Captain Kirk. While they were already proceeding with their intent to "probe out of the galaxy", the Enterprise unexpectedly encountered the Valiant's "Old-style ship recorder". The encounter with the Valiant's "Old-style ship recorder" is not the cause for the Enterprise probing out of the galaxy. The Valiant's recorder is just a chance encounter while already on the way to probe out of the galaxy. The mission was not "Find the Valiant", or "Find how the Valiant was destroyed". The Valiant's ship recorder just happened to be detected on the Enterprise's way to "probe out of the galaxy".
That said, there is nothing in canon that says that the higher-ups in Starfleet ordered it. Kirk could have just decided to "probe out of the galaxy" on his own because "other vessels will be heading out here someday and they'll have to know what they'll be facing." If that is the case: Kirk is a captain in Starfleet. Thus, it was de-facto ordered by Starfleet. However, the episode implies that it was an official mission.
If the information in the reportedly "original" version of the introduction to "Where No Man Has Gone Before" (youtube1, youtube2) is accurate, the full original made it more clear that it was an official mission with some additional lines which appear to have been cut from the released version:
Enterprise Log, Captain James Kirk commanding: We are leaving that vast cloud of stars and planets which we call our galaxy. Behind us, Earth, Mars, Venus, even our Sun are specs of dust. A question: What is out there in the black void beyond?
Until now, our mission has been that of Space Law regulation, contact with Earth colonies, and investigation of alien life. But now... a new task. A probe out into where no man has gone before.
Ironically, almost immediately, we find out that some other man has gone there before: the crew of the Valiant.
Ordered by Admiral Saylor in the EU:
Memory Beta indicates that the order to probe outside the galaxy was given to the Enterprise by Admiral Saylor of Starbase 33:
In 2265, Admiral Saylor of Starbase 33 ordered the USS Enterprise to explore the edge of the galaxy, and even probe beyond the barrier.
Memory Beta credits this to the TNG novel Q-Squared. This statement is repeated on Memory Beta's Admiral Saylor page. However, if this is actually Admiral Saylor ordered, then the question that arises is: How did Admiral Saylor know there was a barrier? I have not read Q-Squared, and nothing that is stated in "Where No Man Has Gone Before" indicates that Kirk knew in advance that there was a barrier. Thus, I am assuming that Memory Beta has gotten the wording somewhat wrong. It probably should be just "beyond the galaxy."
It appears this is at least partially covered in the book Tos #86 Constitution: My Brother's Keeper Book Two. I don't have the book, so I've pieced together a quote using Google Books, which, unfortunately, does not have the needed page as a preview:
"As you can imagine," said the admiral, "Starfleet Command has been eager to hear the results of your mission, Jim. They've sent Captain Damion to conduct the debriefing."
He gave you new orders—to explore and even exceed the boundaries of our galaxy."
Kirk nodded. "That's correct. And , of course, we followed those orders to the letter."
"You reached the limits of our galaxy?"
Does the Enterprise actually get out of the galaxy?
There is no statement that the Enterprise actually left the galaxy. However, it is stated that the Valiant did get about a half a light year beyond the galaxy:
SPOCK: Swept past this point, about a half light year out of the galaxy, they were thrown clear, turned, and headed back into the galaxy here. I'm not getting it all. The tapes are pretty badly burned. Sounds like the ship had encountered some unknown force. ...
One would expect that the two centuries newer Enterprise could do at least as well with respect to how far outside the galaxy they were able to probe.
The distance to the edge of the galaxy and time taken to get there:
Nothing is mentioned about the distance they traveled to "probe out of the galaxy".
Out of universe: This was the 2nd pilot episode. At that time, the writers probably had very little concept of the distance from the Earth to the "edge of the galaxy", the speed of the Enterprise traveling at warp, etc. Assuming the Enterprise traveled in planar motion only for the 30,000 light years you mention, it is not something that can really be reconciled with respect to the 70 years that Voyager would take to go 75,000 light years, in a much faster ship. At the time "Where No Man Has Gone Before" was written and filmed they had, at best, only just begun to think about these types of issues. Things has gotten significantly more fleshed out in the almost 30 years between the original series and the beginning of Voyager.