CFG to Chomsky normal form
Removing $\epsilon$ transitions:

Consider the rule $B\to \epsilon$. We want to remove it. To do so, we look for occurrences of $B$ in the grammar, and whenever we see on (e.g. in $S\to aB$), we add the option of choosing $B\to \epsilon$. So the rule $S\to aB$ becomes $S\to a$. Similarly, $A\to B$ becomes $A\to \epsilon$ (which we will have to remove in the next step).

Since $A\to \epsilon$ was introduced when removing $B\to \epsilon$, we now add rules where $A$ appears. For example, the rule $S\to ASA$ becomes $S\to ASA|SA|AS|S$, according to the different options of using $A\to \epsilon$ after $S\to ASA$.

In step 4 - for every rule that yields more than a pair of variables (e.g. in this case $S\to ASA$) we split this into pairs as follows. Introduce a new variable $T$, we add the rules $S\to TA$ and $T\to AS$. Then, applying these forces us to actually have $S\to ASA$.