When a relativistic, femtosecond laser pulse enters a waveguide, the pulse energy is coupled into waveguide optical modes. The longitudinal laser field effectively accelerates electrons along the axis of the channel, while the asymmetric transverse electromagnetic fields tend to expel fast electrons radially outwards. At the exit of the waveguide, the ∼nC, ∼10 MeV electron bunch converts its energy to a ∼10 mJ terahertz (THz) laser pulse through coherent diffraction radiation. In this paper, we present 3D particle-in-cell simulations and theoretical analyses of the aforementioned interaction process. We investigate the process of longitudinal acceleration and radial expulsion of fast electrons, as well as the dependence of the properties of the resulting THz radiation on laser and plasma parameters and the effects of the preplasma. The simulation results indicate that the conversion efficiency of energy can be over 5% if the waveguide length is optimal and a high contrast pump laser is used. These results guide the design of more intense and powerful THz sources.