Upvote:1
I suspect this is not one one ticket, because BA and UA (United Airlines) usually do not interline like this.
If it is separate tickets, you will need to exit through arrivals at T5 to collect your baggage and take the tube or bus over to T2 and re-check-in. As a US Permanent Resident you do not need a transit visa. BA will not interline baggage to UA (or other non-oneworld carriers) under this circumstance, although I suppose there is no harm in asking.
If this is on one ticket (you bought all the flights in the same transaction from the same place to create a single contract) then your baggage will be checked through to UA automatically. You may simply take the airside buses over to T2 when you arrive in T5. Follow the purple signs to Flight Connections: Terminal 2. You do not need to pass through immigration. You can obtain your UA boarding pass in Terminal 2.