The tradition of single actors playing multiple roles goes back to Greek drama, where there were only 3 actors who played all the roles of a drama.
The main reason for doubling of roles in theatre is economical. Actors’ salaries are a significant part of the budget for a performance. If the play is written in such a way as two characters are not on stage at the same time, it’s far cheaper to hire one actor to play them both than two actors.
The logistical issues are especially acute because Shakespeare is often performed by repertory companies, those where you have a fixed size troupe of actors hired for an entire season mounting a rotating set of plays. The problem is that Shakespeare has far larger casts than modern dramas, and so if you hire actors to fill out Shakespeare without doubling, you’ll have far more actors on staff than you need for other plays.
As well as logistics, the characters are quite similar, and so it works well aesthetically too.