In our study, we aimed to explore the genomic and phenotypic traits of Priestia megaterium strain B1, which was isolated from root material of healthy apple plants, to adapt to the endophytic lifestyle and promote plant growth. We identified putative genes encoding proteins involved in chemotaxis, flagella biosynthesis, biofilm formation, secretory systems, detoxification, transporters, and transcription regulation. Furthermore, B1 exhibited both swarming and swimming motilities, along with biofilm formation. Both genomic and physiological analyses revealed the potential of B1 to promote plant growth through the production of indole-3-acetic acid and siderophores, as well as the solubilization of phosphate and zinc. To deduce potential genomic features associated with endophytism across members of P. megaterium strains, we conducted a comparative genomic analysis involving 27 and 31 genomes of strains recovered from plant and soil habitats, respectively, in addition to our strain B1. Our results indicated a closed pan genome and comparable genome size of strains from both habitats, suggesting a facultative host association and adaptive lifestyle to both habitats. Additionally, we performed a sparse Partial Least Squares Discriminant Analysis to infer the most discriminative functional features of the two habitats based on Pfam annotation. Despite the distinctive clustering of both groups, functional enrichment analysis revealed no significant enrichment of any Pfam domain in both habitats. Furthermore, when assessing genetic elements related to adaptation to endophytism in each individual strain, we observed their widespread presence among strains from both habitats. Moreover, all members displayed potential genetic elements for promoting plant growth.IMPORTANCEBoth genomic and phenotypic analyses yielded valuable insights into the capacity of P. megaterium B1 to adapt to the plant niche and enhance its growth. The comparative genomic analysis revealed that P. megaterium members, whether derived from soil or plant sources, possess the essential genetic machinery for interacting with plants and enhancing their growth. The conservation of these traits across various strains of this species extends its potential application as a bio-stimulant in diverse environments. This significance also applies to strain B1, particularly regarding its application to enhance the growth of plants facing apple replant disease conditions.