We present a semi-analytical approach to study the energy dissipation in carbon nanotube (CNT) beam oscillators under gigahertz excitation. The energy dissipation properties are quantified by the quality factor (Q factor) and associated anelastic properties. Our study reveals that the Q factor is related to the tube radius through an inverse relation for both single walled CNTs (SWCNTs) and multiwalled CNTs (MWCNTs) beam oscillators. At frequency close to the resonance range, significant energy dissipation is observed due to the activation of phonon modes that serve as a major mechanism for energy dissipation in SWCNTs. For MWCNTs, a registration dependent potential (RDP) is introduced to study the effect of intertube registration. Interlayer friction arising from the bond overlap is shown to contribute significantly to the additional energy dissipation. Based on the extensive simulation studies, an analytical formula for estimating the Q factors of MWCNTs is proposed. Validation of the analytical prediction with the available experimental data yields a good agreement and quantifies the roles of different factors contributing to the energy dissipation through anelastic relaxation.