Carbon has the atomic number 6, which also equals the number of electrons. According to the rules determining electronic configuration (Aufbau, Pauli, and Hund), these electrons are arranged in the 1s, 2s, and 2p subshells of the Carbon atom to give the complete electronic configuration - 1s2 2s2 2p2. This electronic configuration of Carbon, where the electrons are in their lowest energy states and closest to the nucleus, is called the ground state electronic configuration.
The last shell - 2p2 is Carbon’s outermost shell, also known as the valence shell. In bond-forming reactions, only the valence shell participates.
If only valence shells participate in bonding reactions, then Carbon should only form two bonds using its two unpaired electrons. However, Carbon forms four bonds, as seen in CH4, CH3X, H2C=O, and O=C=O molecules. This discrepancy between the number of valence electrons of an atom and the number of bonds it forms (valency) is explained by the hybridization concept, an extension of the Valence Bond (VB) Theory.
Hybridization rationalizes the covalent bond formation to the excitation of electrons (not always) to give more unpaired electrons and the mixing of atomic orbitals close in energy to form newer, improved hybrid orbitals. These hybrid orbitals are then used for the bond formation process.
In the example of Carbon, the hybridization concept proposes the excitation of the 2s electrons to the 2p level to obtain a new electronic configuration of Carbon as 1s2 2s1 2px1 2py1 2pz1.
The mixing of 2s1 2px1 2py1 2pz1 forms four equal energy sp3 hybrid orbitals. These orbitals then arrange themselves in tetrahedral geometry, keeping an angle of 109.5o between them (VSEPR theory, an extension of the Valence Bond Theory, explains molecular shapes).
The single unpaired electrons in these sp3 hybrid orbitals then overlap with the s-orbitals of the substituent (H in the case of CH4) to form a sp3-s single covalent (sigma) bond.
So, the central carbon atom becomes sp3 hybridized to form four bonds with four Hydrogen atoms.
Another shortcut to determine hybridization is by finding the steric number and correlating the number with hybridization, though there are exceptions to this method of prediction.
Note - Shortcut to determine hybridization with solved examples, sp3 hybridization of Carbon, Nitrogen, and Oxygen, sp2 hybridization of Carbon, Carbocation, Nitrogen, and Oxygen, and sp hybridization of carbon and nitrogen is covered in the Hybridization Chapter of Introductory Organic Chemistry course.