Strategy Coopetition Explains the Emergence and Transience of In-Context Learning