In the name of Allah, the compassionate, the merciful
In regard to your query as you inquired:
Am I allowed to change my intention to pray asr after making an
initial intention of praying maghrib during the salah??
It is not wajib --obligatory-- to do the Qaza (of Asr prayer) just at that time of Maghrib Salah, haply: it is better if you say your maghrib prayers (Jama'a), then (or after Asha' prayer) you can do it. Or even you can do its Qaza tomorrow or later, but this is better to do it as soon as possible ... / Thus you'd better to do your Maghrib salah by the maghrib salah of the Jama'a... Then...