LONDON—Walmart Inc. is in advanced talks to sell a majority stake in its U.K. grocery chain Asda Group Ltd. to rival J Sainsbury PLC, according to people familiar with the situation, a sign that the retail behemoth aims to reduce risk in one of the world’s most competitive markets as local players consolidate.

Such a deal would create a U.K. food giant worth around £12 billion ($16.54 billion), with combined annual revenue of about £50 billion, according to the latest available financial results.

In...