Now I need to know What Episode of
Star Trek that clip is from!!!
I suspect it’s from a “blooper reel.”
I think it’s from Turnabout Intruder, the last episode in the last, third, season. A crazy female wants Kirk’s job and decides the way to do it is change bodies with Kirk, so Shatner plays a man/woman trying to mimic Kirk’s mannerisms, but who is still uncontrolled crazy, and the guest plays a woman/man with Kirk’s instinctive mannerisms. It gets sorted out by Spock mindmelding the woman and recognizing his captain.
I’m pretty sure that’s the episode with Lord Garth, where he changes into Kirk’s form but realizes he can’t fool the Enterprise crew into beaming him up. “Whom Gods Destroy”, episode #69. You can’t watch them for free on the internet anymore, though.