A lot of it is for historical reasons, CS basically developed as the intersection of 2 disciplines - EE and math.
Back when computers were large electrical behemoths they took a ton of hardware/electrical skills to program and use. Then, when higher-level programming started becoming popular (languages like B and C, etc.) universities started offering classes in programming out of the EE departments since there weren't enough programming classes to create a new department for CS.
On the other hand, there were many mathematicians from the late 1800s through the 1950s who were developing mathematical algorithms before "computers" were widely used. Many of these algorithms are now widely used by computer scientists and programmers to solve incredibly complex problems.
Currently there are two main "flavors" of CS. Some universities like UC Berkeley and MIT maintain joint EE and CS departments while others like Stanford and Harvard have CS departments that are more closely related to math.
TL; DR: it comes from the history of how CS developed out of EE (computing machines) and math (algorithms).
Back when computers were large electrical behemoths they took a ton of hardware/electrical skills to program and use. Then, when higher-level programming started becoming popular (languages like B and C, etc.) universities started offering classes in programming out of the EE departments since there weren't enough programming classes to create a new department for CS.
On the other hand, there were many mathematicians from the late 1800s through the 1950s who were developing mathematical algorithms before "computers" were widely used. Many of these algorithms are now widely used by computer scientists and programmers to solve incredibly complex problems.
Currently there are two main "flavors" of CS. Some universities like UC Berkeley and MIT maintain joint EE and CS departments while others like Stanford and Harvard have CS departments that are more closely related to math.
TL; DR: it comes from the history of how CS developed out of EE (computing machines) and math (algorithms).