When objects collide and the collision is inelastic the total momentum is conserved though total kinetic energy may not be conserved.
Here the objects collide and stick together, so we can say that the collision is inelastic.
Let the initial velocity of the object of mass 10 kg be V. The object of mass 5 kg is stationary and has no momentum. The total momentum of the system initially is 10*V + 0 = 10*V.
After the objects collide, they move forward with a velocity of 4 m/s. Therefore the momentum is (10 +5)*4 = 15*4 = 60 kg*m/s.
Equating the final momentum in the system to the initial momentum we get
60 = 10*V
=> V = 60/10
=> V = 6 m/s
Therefore the original velocity of the moving object was 6 m/s.