This film commemorates the 20th anniversary of the anime and takes place during the same time period as the first season. Throughout the film, Ash notes that Pikachu can’t stand going on his Poké Ball. Ash doesn’t press for why, but respects his decision and let’s him stay outside.
During the climax, Ash tells Pikachu to get in his Poké Ball while he holds off a horde of angry Pokémon (in an event reminiscent of their first day encounter with an angry flock of Spearow). Pikachu refuses and Ash asks in desperation why he doesn’t want to go into his Poké Ball.
As Ash starts to lose consciousness
he hears Pikachu speak saying: “It's pi-cause... It's because I always want to be with you...”
It’s not clear whether this is a hallucination, rainbow magic, or a representation of Ash suddenly understanding Pikachu, but there we have it straight from the electric mouses’s own mouth: Pikachu cares so much about Ash that he doesn’t want to go into his Poké Ball and stay apart from him.
Note that while this explains why Pikachu doesn’t want to go into his Poké Ball since he bonded with Ash, it doesn’t explain his refusal to go into one before then, and the movie does not provide any explanation for that.