Significance Natural physical systems evolve with certain global quantities being minimized or maximized due to physical laws. For example, charges in conductors redistribute to reach electrostatic equilibrium, minimizing electrostatic energy, and gases spread to maximize entropy. This research leverages these natural efficiencies by encoding optimization problems, like training artificial neural networks, into the evolution of physical systems. The concept is called “physical self-learning” where systems’ intrinsic parameters autonomously evolve guided by natural laws. Specifically, a physical Hopfield neural network using a magnetic thin film is developed. Inputs are encoded as electric signals that manipulate magnetic textures within the film through Oersted fields, enabling the film to learn from external inputs and perform tasks like associative memory of similar patterns.