If we find asteroid flying towards us, can we change it's direction with white painting? Will the ray from sun do something?
@called2voyage's comment points you to an in depth discussion. I'll add to that a simple summary of some things.
If you imagine that the astroid is in a simple, circular orbit around the Sun that's defined only by gravity, let's call that the nominal orbit.
Now consider the effects of sunlight.
If the asteroid were white or reflective, then a lot of the incident sunlight will reflect back towards the Sun, pushing the asteroid away from the Sun. Since both gravitational attraction and the Sun's brightness vary as $1/r^2$, so to the asteroid it feels like gravity is just a little weaker or the Sun is a little lighter, but otherwise still feels like gravity. If the asteroid became reflective slowly, it would just move to a slightly larger radius and remain in circular orbit.
Remember that the incident photons, and the reflected photons both contribute to the push!
If the asteroid were black and absorbing, then the absorption of the photons would give a push, and then they would warm the asteroid. Warm things radiate heat, and once equilibrium were reached, the radiation would also be a source of pressure.
If the astroid didn't rotate fast, but instead turned slowly so that it had a warm side always facing the Sun and a cold side always facing away, then the radiated infrared photons would also result in a push away from the Sun! So a dark asteroid that turned so slow that it had a permanent hot and permanent cold side would also be at a larger radius than nominal. The difference between the two depends on the functional form of the diffusivity and roughness of the surfaces.
However if the dark asteroid were rotating fast, say every few hours or tens of hours, then the radiation would be a little stronger in the forward or backward direction with respect to the orbit. If it was rotating the same sense as its orbit, the hot side would turn backwards, radiate backwards, and push the asteroid forward. That would slowly, but continuously raise the orbit of the asteroid. The longer this happened, the larger and larger its radius would become.
This is called the Yarkovsky effect and over long periods of time (millions of years) can have a big impact. For an asteroid to just miss the Earth, maybe a few years would be enough.
It turns out that @ BobJacobsen's answer to Why paint only one-half of Bennu? is, in a highly condensed and stylized form; "because the Yarkovsky effect is strong enough that there's no point in wasting good 'space paint' on the other half."
If you are a tiny dust particle near the Sun, there is yet another thing that happens, called the Poynting–Robertson effect.
Tiny bits of dust have a higher area to mass ratio, so even though they may be in thermal equilibrium and not have a hot and cold side, tiny forces make a big difference. And if you are close to the Sun, then the forces are less tiny i.e. larger. @honeste_vivere's excellent answer points out that the Poynting–Robertson effect can cause the radius of the dust particles' orbits to decrease over time. An effect similar to (identical to) astronomical aberration will cause more pressure at the front of the dust particle, pushing it backwards and causing it to spiral closer to the Sun over time.