Model calculations have been performed to study systematically the formation of a two-dimensional electron gas (2DEG). The results are used for analyzing the photoluminescence properties of corresponding InAlN/GaN heterostructures (HS) for various In concentrations (x = 6.7–20.8%). We found a luminescence peak, clearly dependent on the In content, that is attributed to the recombination between electrons in the 2DEG at the second level (En=2) and photoexcited holes in the GaN buffer. The results can be understood with the changing band profile attributed to the different polarization gradient between InAlN and GaN.