That is a good question. F=ma is a special case of Newton's 2nd Law of Motion . Newton's second law states that: The rate of change of linear momentum is proportional to the applied force and acts in the same direction as the force. Newton's 2nd Law implies F=ma only if the mass of the change of momentum stays constant. Here I will write how you can get F=ma from the second law if the mass stays the same.
Final momentum: P_f=m_f x v_f , m_f is final mass, v_f is final velocity
Initial momentum: P_i=m_i x v_i , m_i is the initial mass, v_i is the initial velocity
now F is proportional to the rate of change of momentum.
F=k x (P_f - P_i)/t
F= k x ( m_f x v_f - m_i x v_i)/t
We know the mass stays the same so m_f=m_i
F= k x ( m_i x v_f - m_i x v_i)/t
Factorise m_i out
F= k x m_i x(v_f - v_i)/t
write m_i =m to make it look nicer
F= k x m x(v_f - v_i)/t
we know v_f = v_i + at from our SUVAT equations so
a = (v_f - v_i)/t by rearranging the equations
Plug this in the equation then we get
F=ma