From mysql documentation
The effect of a stored routine or trigger upon the value of LAST_INSERT_ID() that is seen by following statements depends on the kind of routine:
....
For stored functions and triggers that change the value, the value is restored when the function or trigger ends, so following statements do not see a changed value. (Before MySQL 5.0.12, the value is not restored and following statements do see a changed value.)
Thus whatever happens inside the trigger[s] on A does not affect value returned by LAST_INSERT_ID() executed outside of trigger's body. Withing the trigger body LAST_INSERT_ID will reflect inserts you made to another table. To get last id for B you need to store the value of LAST_INSERT_ID() somewhere(new table, or a new column in A), for instance,
delimiter /
CREATE trigger biA before insert on A
for each row
begin
insert into B(name) values('aaa');
set new.b_id := (select last_insert_id());
end;
/