Look at a nucleus such as helium-4: two protons squeezed into a space about 3 fm across. Protons are positive, so they repel each other.
Let us put a number on it. Two protons 1 fm apart push on each other with an electric force of
F = k e² / r² ≈ (8.99 × 10⁹) × (1.60 × 10⁻¹⁹)² / (10⁻¹⁵)² ≈ 230 N.
That is about the weight of a 23 kg mass, acting on one proton. What about gravity between them? It comes to about 2 × 10⁻³⁴ N, which is around 10³⁶ times weaker. Gravity is irrelevant in a nucleus.
Something else must bind the nucleus together, and it must be stronger than 230 N at that distance. That something is the strong nuclear force.