RedirectResponse not able to redirect in hook_entity_view drupal 8
Thank you, I got it working.
Don't need to return the object of RedirectResponse. It works like this.

$response = new RedirectResponse($redirect_url);

$response->send();

It works this way.