Why are these T-SQL jobs from different SQL Server instances executed on the same instance (AlwaysOn Availability Groups)
I don't have a diagnosis for why this problem occurred, but if you have jobs running on databases that are in availability groups, it's best to include a check in step 1 that uses the fn_hadr_is_primary_replica function to check whether it is running on the primary or secondary.

IF (sys.fn_hadr_is_primary_replica('DB1') &lt;&gt; 1)
  BEGIN
    RAISERROR('%s is secondary', 11, 1, @@servername );
  END


Configure this step to quit the job on failure.  This is better than trying to run something that fails because it's hitting a secondary.