Britain was: anti-slavery; dependent on the US for 40% of its food imports; facing conflict in Europe; and given its possessions (eg Ireland) should have been ideologically opposed to even the concept of secession.
In the end Britain never even recognised the CSA, let alone allied with it. Britain was officially neutral but highly supportive of the US, with trade between the CSA and Britain falling 90%.
How could the CSA possibly have imagined that Britain would become an active belligerent on their side?
Britain had been the world leader in textile technology. Quite early on in the mid 18th c. it had mechanized spinning, with the Arkwright spinning frame, and weaving, with the "flying shuttle" loom. In the early 1800's sizeable water-powered textile mills were producing large volumes of cotton cloth in Lancashire. This industrialization coincided with the invention and spread of Whitney's cotton gin in the southern US, where there was both a good climate for growing cotton and an enslaved workforce to cultivate it. From 1830 to 1860 there was enormous demand for cotton by British textile mills, and enormous growth in cotton production in the South to supply them. By 1860, the South also supplied textile mills in France, Germany and Russia, and cotton exports were certainly their most important source of money.
The North knew this, and pretty quickly put an embargo on shipping from and to the South, setting up an effective naval blockade. The South believed that, threatened with a cut-off of supplies for their mills, Britain and other countries would be quick to recognize the Confederacy. There were also early victories of the Confederate armies against the North that fed an already unrealistic optimism that the war would soon be over. As they likened secession to the revolt of the thirteen colonies in 1775, they may have also thought that, just as happened then, international recognition would follow military success. There were some low-level communications by French and English consuls that also misled them as to the actual political positions of those governments. Britain and Europe did not, however, recognize the CSA and tried to stay neutral. Then the South , led by Jefferson Davis, imposed its own embargo, refused to export to countries that did not recognize it. This did create an outcry by textile factory owners in Britain and France, and they certainly did make their wishes known to their governments. But, as you know, it did not change the minds of the political leaders. There was a cotton "famine" in Europe, during the War, but the embargo stayed.
You could simply say that the same hubris that made the South think that secession was a great idea also made them think that their trading partners would quickly rush forward to be their allies.
Blumenthal, H. (1966). Confederate Diplomacy: Popular Notions and International Realities. The Journal of Southern History, 32(2), 151–171. https://doi.org/10.2307/2204555
This older thread is of note, particularly this answer by /u/The_Alaskan on the Trent and Laird Rams affair and subsequent discussion by /u/agentdcf and /u/Georgy_K_Zhukov on various aspects of the likelihood of Britain going to war.
My own comment on the Trent is that more recent research indicates there was quite a bit more peril than is generally believed with Stahr's Seward covering the incident in greater detail than any previous source I'm aware of. Seward was already concerned as to a saltpetre embargo within a few weeks of the capture in November, and Lincoln - who was at that point a relative naif in foreign affairs - had planned to stick to a policy of keeping the prisoners captive while an international arbitration board negotiated what actions were appropriate.
The British Ambassador, however, had already received instructions that he was to get a simple "Yes" or "No" to the prisoners' release within seven days of receipt of that message, and if the answer had been "No" - which Lincoln's request for an arbitration would have qualified as - he was to be recalled to Britain with his staff via the British Fleet, with Stahr concluding that the situation was very reminiscent of the Cuban Missile Crisis in that it would have taken a very small misstep precisely like this to get one side or the other to declare war.
Fortunately, the meetings of the Cabinet on Christmas Day and the 26th got Seward - who had received dire warnings from multiple sources in Europe - to argue with Lincoln that his concerns over rousing "the displeasure of our own people - lest they should accuse of timidly trucking to the power of England" were less important than avoiding war. Lincoln being Lincoln, he instructed Seward (who was very much in the minority in the Cabinet) to write up a brief of why they needed to release the prisoners, he would write up one why they shouldn't, and once this was concluded Lincoln very shortly thereafter decided to adopt Seward's position.
Seward had to do some substantial politicking via newspapers to explain to the American public why the administration was backing down (which when provided in detail was generally well received), but by January the prisoners were released and apparently crowds in British theaters stood up to applaud the news that there wouldn't be a war.
So pride and admiralty law might very well have brought the United Kingdom in against the United States despite mutual national interests suggesting such a policy was unthinkable, but fortunately cooler heads prevailed.