The invention provides a device and measuring method for the hydrocarbon diffusion coefficient in rocks under high temperature and high pressure. The device mainly comprises a rock diffusion coefficient tester, a vacuum pump, a confining pressure pump, hydrocarbon gas source, nitrogen (N2) gas source, a left piston container, a right piston container, an automatic pressure pump, a chromatographic detector, a computer, a drying device and a rock saturated water device and the like. According to the device and method, the consistent accurate accordance of the gas injection balance pressure in the diffusion chambers respectively arranged at two ends of a core holder can be achieved and the existence of the hydrocarbon diffusion driven by the concentration gradient not by the pressure gradient in the whole process of experiment is ensured. Meanwhile, according to the device and method, the problem of low gas injection balance pressure, relatively low experimental temperature and having difference with the actual formation condition of the gas source balance pressure control device in the measuring of normal diffusion coefficient is resolved.