虫 is the insect radical and files 蚁 in the bug family - same indexing in 蜂 bee, 蝴 butterfly, 蛇 snake. Although ants are technically insects of order Hymenoptera, in the Chinese folk taxonomy any small crawler gets 虫.
义 here replaced traditional 蟻's phonetic 義 in the 1956 reform. The simplified 义 keeps roughly the same sound yì, drifting slightly to yǐ. Pure simplified-form phonetic - the 'righteousness' meaning is irrelevant.