You can learn and remember without a brain, for example, there is E. coli

Researchers at Carnegie Mellon University discovered that bacteria can learn from past experiences and adapt their behavior accordingly, even without a nervous system. They studied E. coli's responses to environmental stressors using advanced microfluidic devices. The findings revealed that bacteria retain memories of past environments, influencing their future behavior. This memory is linked to protein production mechanisms, allowing cells to remember information for hours. Interestingly, this memory persists through generations, affecting offspring behavior based on ancestral experiences. The study suggests that bacterial responses to antibiotics may also depend on their previous stress experiences, challenging traditional views on bacterial infections and treatments.