how does data goes into ram from hard disk
Using Direct Memory Access (DMA). The disk controller is given a RAM address, a transfer size and a read or write command. The disk controller handles the data transfer. The CPU is not needed and is free to do other work. When the DMA transfer is complete, the disk controller interrupts the CPU and awaits another command.