It appears nobody knows the origin.
According to the Oxford English Dictionary, "hot cake" goes back to the 17th century, but "sell like hot cakes" shows up in the early 1800s.
- colloq. In pl. in like hot cakes, as the type of something very desirable or in great demand; orig. and frequently in to to sell (also go, go off) like hot cakes.
1839 C. F. Briggs Adventures Harry Franco I. xi. 74 ‘You had better buy 'em, Colonel,’ said Mr. Lummucks, ‘they will sell like hot cakes.’
1879 Congress. Rec. 15 May 1368/1 Four per cent bonds..go off like hot cakes.
1908 Daily Chron. 4 Aug. 3/4 Ice creams at 3d. a time went ‘like hot cakes’.
Mental Floss says...
While the word “hotcake” dates back to the late 17th century and ”pancake” first appears in England around 1400, this phrase, with the figurative meaning “to be in great demand,” didn’t appear until around 1840 and there’s no evidence of a great hotcake demand that might have led to its creation. Instead, etymologists are left to assume that since hotcakes have always been popular at events like county fairs and church socials, where the crowd greatly outnumbers the culinary staff and the cakes often sell as fast as they can be made, the term was coined and spread through popular usage.