For New York, the answer is related to real estate value.
In New York City, the construction of the metro was performed by real estate developers. The idea was to build homes, then connect them to the city with a subway. Sales of the new homes, in principle, then funded the metro system.
Above ground trains were not conducive to high priced luxury apartments.
Prior to the subway, Queens Boulevard had some small communities an a bunch of farms. The construction of the IND Queens Boulevard line coincided with a bunch of new suburban communities, with high rise apartments at express stops like Forest Hills and Kew Gardens, and smaller developments at other stops. Wikipedia mentions a property value increasing from $1,200 in 1925 to $10,000 in 1930; I think while this figure shows investments earning 10x in just a few years, this was just the tip of the iceberg. There were 21 new stops on this subway, each with more than a few mile of intensive real estate development.
While Wikipedia lists concepts like weather and right-of-way costs, real estate money was the key to development in New York because the subways were not publicly funded. This can be evidenced in another Wikipedia paragraph:
In Kings County, elevated railroads were also built by several companies, over Lexington, Myrtle, Third and Fifth Avenues, Fulton Street and Broadway. These also later shared trackage with subway trains, and even operated into the subway, as part of the BRT and BMT. Most of these structures have been dismantled, but some remain in original form, mostly rebuilt and upgraded.
I've always found it astounding when cities in the US actively destroyed parts of their transportation infrastructure. Typically, at least in New York City, the motives for many things related to real estate prices. Evidently, the increase in value of properties along these routes would increase if the elevated tracks were removed, so TPTB decided that they should be removed. Some were replaced with subways, some were replaced with buses, and some with private cars.
As mentioned in the comments, there are still some elevate lines, for example the number 7 train in queens, and the N train in Astoria, and the number 2 train in the Bronx. These areas were historically cheaper than the more expensive, and prestigious areas of Manhattan. Thus most of Manhattan put the subways underground to further increase property values. If things haven't changed to much, the only elevate line in Manhattan is around Washington Heights, where property values are cheaper than the Upper West Side or elsewhere.
What about Chicago?
Chicago is a great city - go Cubs! But it is not in the same league as New York, London, Moscow, Paris, and Tokyo. The urban core is much smaller, there are a lot less people, perhaps 1/4 or 1/3 the population of New York City.
What is interesting about Chicago is that they retained their elevated system. Los Angeles, Detroit, St. Louis, and a bunch of other cities had elevated systems and streetcar systems before the 1950s. These systems were all town down by General Motors, and replaced by bus lines. How did the Chicago "L" system survive?
Perhaps Chicago was big enough to need the system?
I am not 100% certain, but it appears that because of financial trouble in 1932, Chicago Edison Electric Utility divested control of the "L" prior to the Public Utility Holding Company Act of 1935. The city between 1932 and 1935 must have started to begin to gain control of the system, and eventually developed the CTA which took control in 1940, insulating the system from destruction by GM.
It is likely a combination of Chicago being larger than St. Louis and L.A. at that time, and the growth the CTA that saved the "L" from destruction in the 1940's. The reason most of it remain above ground likely related to it being historically much less expensive than Manhattan. I'll see if I can find a source to corroborate this thought.