Carbon nanotubes have a helical structure wherein the chirality determines whether they are metallic or semiconducting. Using in situ transmission electron microscopy, we applied heating and mechanical strain to alter the local chirality and thereby control the electronic properties of individual single-wall carbon nanotubes. A transition trend toward a larger chiral angle region was observed and explained in terms of orientation-dependent dislocation formation energy. A controlled metal-to-semiconductor transition was realized to create nanotube transistors with a semiconducting nanotube channel covalently bonded between a metallic nanotube source and drain. Additionally, quantum transport at room temperature was demonstrated for the fabricated nanotube transistors with a channel length as short as 2.8 nanometers.