How does arduino control a 16x2 or 20x 4 LCD display?

May I know what do all the "0 x 01", "0 x 02" etc etc mean?

Those are sometimes referred to as 'magic numbers' because they appear to only have some mysterious relationship with the real world.

To understand them you have to convert them to binary and then you will have a better chance of finding out how they relate to the information in the datasheet.

Let's start with this batch where I have added the binary values as comments:

// commands
#define LCD_CLEARDISPLAY 0x01   // 0 0 0 0 0 0 0 1
#define LCD_RETURNHOME 0x02     // 0 0 0 0 0 0 1 0
#define LCD_ENTRYMODESET 0x04   // 0 0 0 0 0 1 0 0
#define LCD_DISPLAYCONTROL 0x08 // 0 0 0 0 1 0 0 0
#define LCD_CURSORSHIFT 0x10    // 0 0 0 1 0 0 0 0
#define LCD_FUNCTIONSET 0x20    // 0 0 1 0 0 0 0 0
#define LCD_SETCGRAMADDR 0x40   // 0 1 0 0 0 0 0 0
#define LCD_SETDDRAMADDR 0x80   // 1 0 0 0 0 0 0 0

Now compare this with the command set (Table 6) in the datasheet and you will see that each of the commands in that table starts out (reading left to right) with a bunch of 0s to the left of the first '1' and the first '1' is associated with a different data byte for each command.
Here is a list of those commands with the location of the leftmost '1' identified.

Clear display ............. DB0
Return home ............... DB1
Entry mode set ............ DB2
Display on/off ............ DB3
Cursor or display shift ... DB4
Function set .............. DB5
Set CGRAM address ......... DB6
Set DDRAM address ......... DB7

Now compare the two lists and you should be able to tell where the 'magic numbers' came from.

Don