By using the first-principles ultrasoft pseudo-potential approach of the plane wave based on the density functional theory, the electronic structures and their changes, the bandstructures, the densities of states, and the charge densities of pure Be-doped and Be-O codoped wurtzite AlN are calculated. The calculation results reveal that Be-doped wurtzite AlN gives rise to the formation of deep Be acceptor levels in the band gap and the carriers (hole) are localized near the top of the valence band, and the introduction of activated donor O atoms makes the acceptor level wider and the non-local characteristics distinctive, and can cause the primary level to shift toward the low energy, forming a shallow acceptor level, thereby enhancing the doping concentration of Be atoms and the stability of the system. Be, O co-doped p-type is more conducive to obtaining AlN.