The property of surface activity is usually due to the fact that the molecules of the substance are amphipathic or amphiphilic, meaning that each contains both a hydrophilic and a hydrophobic (lipophilic) group. This assumes that one of the two phases is aqueous, and the other non-aqueous. If both are non-aqueous (e.g. oil/air), molecules containing organophilic and organophobic groups may be amphipathic and surface active.
PAC, 1972, 31, 577. 'Manual of Symbols and Terminology for Physicochemical Quantities and Units, Appendix II: Definitions, Terminology and Symbols in Colloid and Surface Chemistry' on page 612 (https://doi.org/10.1351/pac197231040577)