The earthquakes have adverse effects on utility tunnels passing through hard-soft strata. This paper is the first to conduct shaking table test on the seismic performance of prefabricated utility tunnel passing through hard-soft strata under longitudinal excitation. The standard segments of utility tunnel were made by microconcrete. The prefabricated utility tunnel was assembled by standard segments of utility tunnel through bolts. The silty clay and fine sand were selected to simulate the prototype soft and hard soils. The tests were conducted using the laminar shear box. The test cases were numerically simulated, and numerical results matched experimental results well. By analyzing the seismic responses of the acceleration distribution of the soil, the utility tunnel strain, and the opening of joint, the law and mechanism of seismic response of prefabricated utility tunnel passing through hard-soft strata were revealed. The research results indicated that the relative compressive deformation between soft and hard soils fundamentally caused the axial compressive strains at the utility tunnel segments near hard-soft soils interface. The closer the segment was to hard-soft soils interface, the larger the axial compressive strain of segment. The relative tensile deformation between soft and hard soils fundamentally caused the openings of joints near hard-soft soils interface. The closer the joint was to hard-soft soils interface, the larger the opening of joint. The different mechanical characteristics of prefabricated utility tunnel joints under tension and compression were the reason for the significant difference in seismic responses between prefabricated and integral cast-in-place utility tunnels.