The Ukrainian man, brandishing what he said was a detonator, tried to gain access to the cockpit of the aircraft operated by Turkey's Pegasus Airlines with 110 people on board, officials said.
The Interfax-Ukraine news agency reported that the man was inebriated. The agency and Istanbul's governor Huseyin Avni Mutlu said the man had neither a gun nor explosives.
"A Ukrainian man, born in 1969, was in an advanced state of drunkenness and tried to get into the cockpit, shouting 'Let's go to Sochi'," Interfax-Ukraine quoted Ukrainian security services as saying.
"The man will answer for his hooligan behaviour."
In the air, the pilot emitted a hijack alert and the Turkish F-16 military jets were scrambled. The Boeing 737-800 airliner landed at Istanbul's Sabiha Gokcen airport at 6:05 pm.
The plane was then immediately stormed by Turkish anti-terrorism commandos, reports said.
Turkish television channels showed images of the aircraft surrounded by ambulances, fire engines and police vehicles with flashing lights after it touched down.
Istanbul's governor said that the man had been taken into custody and that all passengers were evacuated safe and sound.
After landing the man "thought at first that he had landed in Sochi. It took some time for him to realise we were in Istanbul," Mutlu said.
The aircraft had taken off from Kharkov, Ukraine for the scheduled flight south over the Black Sea to Sabiha Gokcen. The man wanted to divert it east to Sochi, the Russian city on the Black Sea coast.
Television channels showed a still image of the would-be hijacker with short hair and wearing what looked like a red-white-and-blue ice hockey shirt with the number 11.
High security around Sochi
The incident happened just as the opening ceremony for the $50-billion Sochi Olympic Games - with 40 heads of state and leaders including UN Secretary General Ban Ki-moon and Chinese President Xi Jinping attending - was happening.
Security concerns were already heightened after the United States announced a temporary ban on liquids and gels in hand luggage on Russia-bound flights, following a warning that militants could stuff explosives into toothpaste tubes.
Russia last month banned domestic travellers from having any liquids and gels, including toothpaste, in their carry-on luggage ahead of the Games, which run until February 23.
Russian President Vladimir Putin is under huge pressure to organise a glitch-free Games after a build-up dogged by controversies over gay rights, construction delays and security.
Concerns over militant attacks skyrocketed after two suicide attacks killed 34 in the southern Russian city of Volgograd in December. They were blamed on extremist militants from the Northern Caucasus region.
Russian security forces are still fighting insurgents in the area, which is close to Sochi, and militants have threatened to strike targets in Russia during the sports event.
About 40,000 members of the Russian security forces are on duty in and around Sochi in one of the tightest operations ever mounted at an Olympics.
Two US warships have deployed to the Black Sea, ready to offer assistance in the case of a security emergency necessitating the evacuation of Americans.
US President Barack Obama said earlier Russia had an "enormous stake" in thwarting "terrorism" at the Games, adding that Washington was doing everything it could to help keep athletes safe.