We consider single-period and infinite-horizon inventory competition between two firms that replenish their inventories as in the well-known newsvendor model. Normally customers have a preference for shopping in one firm or the other. A fixed percentage of them who encounter a stockout in the firm of their first choice, though, visits the other firm. This substitution behavior makes the firm's replenishment decisions strategically related. Our main contribution is to introduce a simple learning algorithm to inventory competition. The learning algorithm requires each firm (a) to have the knowledge of its own critical fractile, which the firm can calculate using the values of its own per unit revenue, order cost, and holding cost; and (b) to observe its own total demand realizations. They do not necessarily know their true demand distributions. The firms need not even have any information about each other, beyond the implicit information encoded in their own total demand realizations affected by their competitors' inventory decisions. In fact, the firms need not even be aware that they are engaged in inventory competition. We prove that the inventory decisions generated by the learning algorithm converge, with probability one, to certain threshold values that constitute an equilibrium in pure Markov strategies for an infinite-horizon discounted-reward inventory competition game.