We know that black holes exert a gravitational force on the objects. How can a massless photon go into black hole and not escape from it? The gravitational force is related to mass isn't it? Is there another force in the black hole or does light has mass?

This is a great question!

You are right that according to Newton's gravity, the force of gravity on particle that has 0 mass would be zero, and so gravity should not affect light. In fact, according to Newton's gravity Black holes should not exist: no matter how strong gravity is, light would always be able to escape!

However, we know that Newton's gravity is only correct under certain circumstances, when particles travel much slower than the speed of light, and when gravity is weak... This is certainly not the case near a black hole! When we try to understand how black holes work we need to consider the more general law of gravity which is Einstein's General Relativity...

According to General Relativity, gravity is not a force! On the contrary, gravity just affects how distances are measured, and says what shape has the "shortest" path from one place to another... All particles then follow these "shortest path" routes in their motion. Notice that nowhere so far have I mentioned mass, this rule applies for all matter and energy, whether they have mass or not!

It turns out that very close to the black hole, these shortest paths never cross the event horizon... As a result neither light nor anything less can escape from the gravity field of a black hole!