Where are very high energy cosmic rays produced?
Nobody knows for sure. We believe that cosmic rays with energies up to about 1017 or 1018 eV are trapped within our Milky Way galaxy by magnetic fields. Cosmic rays with higher energies would escape from the galaxy and wander through the vast distances of intergalactic space. Very high energy cosmic rays produced by other galaxies would be able to travel to us as well.