The resistance of cancer and Helicobacter pylori to several drugs reflects a worldwide problem, and it has been the intention of numerous researchers to overcome this problem. Thus, in this study, Acacia nilotica fruits were subjected to HPLC analysis to detect their phenolic compounds and flavonoids. Moreover, A. nilotica‘s anti-H. pylori activity and its inhibitory activity against human hepatocellular carcinoma (HepG-2 cells) were reported. Various compounds with different concentrations, such as ferulic acid (5451.04 µg/mL), chlorogenic acid (4572.26 µg/mL), quercetin (3733.37 µg/mL), rutin (2393.13 µg/mL), gallic acid (2116.77 µg/mL), cinnamic acid (69.72 µg/mL), hesperetin (121.39 µg/mL) and methyl gallate (140.45 µg/mL), were detected. Strong anti-H. pylori activity at 31 mm was reported, compared to the positive control of the 21.67 mm inhibition zone. Moreover, the MIC and MBC were 7.8 µg/mL and 15.62 µg/mL, respectively, while the MIC and MBC of the positive control were 31.25 µg/mL. The concentration of MBC at 25%, 50% and 75% reflected H. pylori’s anti-biofilm activity of 70.38%, 82.29% and 94.22%, respectively. Good antioxidant properties of the A. nilotica flower extract were documented at 15.63, 62.50, 250 and 1000 µg/mL, causing the DPPH scavenging percentages of 42.3%, 52.6%, 65.5% and 80.6%, respectively, with a IC50 of 36.74 µg/mL. HepG-2 cell proliferation was inhibited (91.26%) using 500 µg/mL of flower extract with an IC50 of 176.15 µg/mL, compared to an IC50 of 395.30 µg/mL used against human normal melanocytes. Molecular docking was applied to investigate ferulic acid with the H. pylori (4HI0) crystal structure to determine the best binding mode that interacted most energetically with the binding sites. Molecular docking indicated that ferulic acid was a proper inhibitor for the 4HI0 protein enzyme of H. pylori. A low energy score (−5.58 Kcal/mol) was recorded as a result of the interaction of ferulic acid with the residue’s SER 139 active site caused by the O 29 atom, which was important for its antibacterial activity.