In the standard metric system, Kilo / K = 1,000 units of something, Mega / M = 1,000,000 units of something (and down in scale also by dividing by 1,000). This applies for anything where the standard singular unit is 1, and assumes it can also be multiplied by, or divided into 1,000 pieces. For example: 1 gram equals 1,000 milligrams.
A computer however, does not have one base unit, but two: the bit and the byte. Neither are usefully divisible by 1,000. Conversely, multiplying the byte by 1,000 hides aspects of its structure that are essential to consider when building and programming a computer system. Considering that the metric system is about notating scale, and that there are issues in both directions of scale when applying the metric system to computers, it made sense to modify it slightly when doing so.
Luckily, there is a number very close to 1,000 that does usefully represent the inconvenient internal structure of a bit and a byte, at least at larger scales. That number is 1,024. Early computer scientists decided that for computers, Kilo / K = 1,024 bytes. It followed that Mega / M was 1,024 x 1,024 = 1,048,576 bytes, and so on. (1 GB = 1,024 x 1,024 x 1,024 = 1,073,741,824 bytes, or close to 1 billion bytes).
This "1,024 rule" for the computer application of metric system, matches the physical structure of computer memory exactly - and crucially, the parts of a computer that physically access memory - making it straightforward for programmers and hardware designers to work with and talk about.
---
And, from an alternate 1990's addendum to the previous:
It also means that when you see a Hard Drive advertised with a size of 240 MB, you can be sure that you are in fact getting 240 x 1,048,576 bytes of storage, or 251,658,240 bytes (well over 251 million bytes). That 251 million is, on appearance, quite a bit "more" than 240 MB is one of the bonuses of the "1,024 rule" for the computer metric system that can impact you directly. You're welcome!